Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6588 Discussions

## Use Which Routine for Sparse Matrix-Sparse Vector Multiplication

Beginner
141 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.

3 Replies
Employee
141 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.

Black Belt
141 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?

Beginner
141 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