Page 1 of 1

DGELS and sparse matrix

PostPosted: Mon Aug 13, 2018 3:31 pm
by Telemachus
Hi. I am solving an under-determined system with DGELS. The matrix A has dimensions MxN, with M<N. This matrix is sparse, but is non diagonal, the elements appear at some determined places.

I wanted to know if there is a way to tell lapack that this matrix is sparse, in order to not having to initialize all the entries that are zero, saving memory space, and avoiding trivial computations like a(9,9)*zero. What I would like to do is to entry only the non zero elements, and then lapack do the thing. Is there a way to do this?

Bye there!

Re: DGELS and sparse matrix

PostPosted: Mon Aug 13, 2018 9:06 pm
by Julien Langou

As you noted, LAPACK is about dense matrices.

If you feed a sparse matrix to LAPACK, LAPACK will not take advantage of the sparsity. (As you are correctly stating.)

If your matrix is banded then you can use LAPACK and LAPACK will take advantage of the band structure, but it will assume density in the band.

For sparse matrices and QR factorization, there are currently two nice projects that I know of.
The goal for both of these software is to compute QR factorization of sparse matrices (and take advantage of the sparsity).