Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Sparse least squares?

tfinniga
Beginner
440 Views
So, I was wondering what the best way to solve a sparse least squares problem (Ax=b) with the MKL is.
The two ways that I can see are:
1 - use LAPACK (which I don't believe is sparse, so probably not usable)
2 - compute ATAx=ATb sparsely (perhaps using sparse BLAS?) and then use one of the sparse solvers, like PARDISO or dss.

I don't have a lot of applied math experience, so if there's some better way, I would love to hear it. Right now I'm using CSparse's qr solver, looking to see if there's a simple way to get better performance.

Thanks
0 Kudos
1 Reply
Sergey_P_Intel2
Employee
440 Views

Hi!

You can use MKL LAPACK to solve a least squares problem, but in this case you should convert your data from sparse format into dense one. This approach leads to extensive usage of memory, so it is limited by the size of physical memory and size of solved task.
To solve this problem in sparse format, you can use SpaseBLAS functions to compute A^T A and A^T b. For example you can use mkl_?csrmm function to compute matrix-matrix product in the CSR format and mkl_?csrgemv to compute matrix-vector product (also in CSR format, see MKL manual). Then MKL PARDISO (or DSS simplified interface to PARDISO) could be used to solve obtained system of equations. Note that PARDISO demonstrated good scalability on shared memory systems.

- Best regards, Sergey
0 Kudos
Reply