transpose matrix stored in CSR format using MKL

transpose matrix stored in CSR format using MKL

All,

I have some legacy parallel code that uses CSR format to store a very large, sparse matrix. In making some additions to the code, I have the need to transpose the matrix, storing the transpose in CSR format as well.

Is there a routine in the MKL that would help me do this? I thought of using a BLAS routine to repeatedly multiply column vectors with ones in successive locations by the matrix, and accumulate the results. Is there a better way?

Thanks,

Tom

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Here is an idea for you to evaluate -- it may not be as efficient as writing your own code to do the transformation, but it is unlikely to lead to a bottleneck.

Note that the CSR representation of a matrix A is identical to the CSC representation of AT. Therefore, code using the relevant version of mkl_?csrcsc may be the easiest to implement.

Alternatively, convert the CSR representation to a COO representation, say (IC, JC, VC). The COO representation of the transpose is (JC,IC,VC). Convert this COO representation to a CSR representation of the transposed matrix.

Which option to use depends on what other transformations you need to perform, if any, in addition to transposing.

Routines for doing the conversions indicated are provided in MKL.

 

Thanks, that look like a promising approach!

Regards,

Tom

Login to leave a comment.