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

Use Which Routine for Sparse Matrix-Sparse Vector Multiplication

Pouya_Z_
Beginner
419 Views

I have a huge matrix with very few non-zero elements. Some of the columns and rows may also be completely zero. This matrix should be multiplied by a very long vector which has only few non-zero elements. I know that mkl_?cscmv performs the sparse matrix-vector multiplication but apparently only the matrix can be sparse. I am wondering if there is any MKL routine to calculate the production of such matrix and vector.

Thanks in advance for your help

0 Kudos
3 Replies
Hans_P_Intel
Employee
419 Views

You can have a look at mkl_?csrmm, mkl_?bsrmm, mkl_?cscmm, or mkl_?coomm and simply treat the vector as a sparse matrix.

0 Kudos
mecej4
Honored Contributor III
419 Views

The answer depends quite a bit on the representation that you have used for the sparse vector that you wish to multiply the sparse matrix into. Do you know the indices of the vector entries that are not equal to zero? Do you know the indices of the result vector that are not equal to zero?

0 Kudos
Pouya_Z_
Beginner
419 Views

mecej4 wrote:

The answer depends quite a bit on the representation that you have used for the sparse vector that you wish to multiply the sparse matrix into. Do you know the indices of the vector entries that are not equal to zero? Do you know the indices of the result vector that are not equal to zero?

Each sparse vector is represented by <nz, nRows, ind, data>, where nz and nRows represent number of non-zero elements and number of rows, ind is an array representing index for non-zero elements, and data is an array representing value of non-zero elements. So, I do have the indices of input vector.

For the resulting vector, I know everything except data, i.e. I know what the indices for non-zero elements will be.

Thanks

0 Kudos
Reply