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

Question about mkl_?csrgemv


Hi, when I read reference manual of mkl, the mkl_?csrgemv routine calculates y=Ax (or y=A'x) where A is m-by-m matrix in 3-array CSR format.

However, when I tested, I figured out that this routine also works well in m-by-k matrix (both k<m and k>m).

Also, proper results are obtained even when I set ja and a not in order.

 ex) for 2-by-2 matrix, [(1, 2), (3, 4)], I set ja(1)=2, a(1)=2, ja(2)=1, a(2)=1, ...


Does this routine updated in recent version?

0 Kudos
2 Replies
Black Belt

Some of the stated restrictions become understandable only if you consider that the routine in question can be asked to compute ATx or A.x, depending on the value of the UPLO argument. Unlike in the dense case, obtaining the CSR representation of AT, given A in the same representation, is not entirely trivial.

I sometimes feel that it would have been better to have separate routines for computing A.x and ATx when A is a sparse matrix in CSR or CSC format. With COO, things are simpler since all that needs to be done is to interchange row and column indices of nonzero entries.

0 Kudos

Also please note that these functions have been marked deprecated since mkl 2018 update 2 release.  They have been replaced by the Sparse Blas Inspector Executor functions ( ) which provide much more opportunity to improve performance.

For instance the new function call would be using the function

mkl_sparse_?_mv(...)   (

which can optionally be preceded by some optimization hints for even faster performance using

mkl_sparse_set_mv_hint(...) ( ) and then mkl_sparse_optimize(...) ( ).

This setup will take in all sorts of size matrices and the hints provided allow the mkl_sparse_optimize(...) to make some decisions for internal data storage that will provide improved performance of the mv (or which ever operation hints were provided) operation.

0 Kudos