Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
83 Views

mkl_?dnscsr deprecated, alternatives?

Since  "mkl_?dnscsr" (dense to sparse matrix conversion and vice versa) is deprecated, what should we use instead?

For sparse to dense conversion I could simply use "mkl_sparse_?_spmmd" (product of two sparse matrices, store result as dense matrix), but I couldn't find anything for dense to sparse conversion.

Also, if you happen to know why this method was deprecated, it would be good to know as well. Based on that, I could make my decision to use it anyway.

Regards, Robert

0 Kudos
3 Replies
Highlighted
Black Belt
83 Views

Storing a sparse matrix in dense format is wasteful of both memory and CPU. Often, it may be impossible to store the dense matrix, mostly full of zero-valued elements.

If it is possible to process the matrix entries in (row, column) order, as each matrix element (or element contribution) is computed, we know i, j and ai,j. We can immediately update the row-index, column ID and value 1-D arrays, without using the dense representation at all. In other cases, a little bit of sorting and merging may be needed to form the CSR representation.

0 Kudos
Highlighted
Beginner
83 Views

Hi,

thanks for the reply!

I think sometimes storing a sparse matrix as dense is justified. In my case, I have a small sparse square matrix A and I want to solve a linear system with multiple sparse right hand sides B, s.t. AX = B, where A is size (k x k), B is size (k x n) and k << n.

Now, A can either be sparse or dense, because conversion is cheap, whatever the scenario requires.  But in order to make use of the fast BLAS solvers, I have to store B as a dense matrix first.
Also, I haven't found a solver that can deal with multiple sparse right hand sides. Maybe someone has an idea what to do best in this case. Creating my own custom solver is most definitely not a good idea.

regards, Robert

0 Kudos
Highlighted
Black Belt
83 Views

I see. Your matrix sizes do not fit the description that I had in mind for "sparse matrix".

Does your linear equation solver have the ability to exploit the sparseness of matrix B? Do all columns of B have the same rows in which the entries are zero?

0 Kudos