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

Sparse matrix coordinate to CSC conversion

Petros
Beginner
899 Views

Hi,

I have a matrix in COO format and want to convert to CSC to be used with KLU solver from SuiteSparse. MKL comes with several converters, but I don't seem to find a mkl_?CSCCOO. Is the only way to do this is through :

mkl_dCSRCOO(...)
mkl_dCSRCSC(...)

Any faster way?

Thanks in advance, Petros.

0 Kudos
1 Solution
mecej4
Honored Contributor III
899 Views

You may be able to skip the conversion altogether if the solver allows you to solve ATx = b in the solution phase, because the CSC representation of A is identical to the CSR representation of AT.

You can use a COO ⇒ CSR converter to do a COO ⇒ CSC conversion by interchanging the COO row and column index vectors in the call. A couple of points to consider carefully: COO data may be in arbitrary order, whereas CSC and CSR have to be in prescribed order; COO data may contain multiple entries for any matrix position, and these entries need not appear consecutively. Make sure that the conversion routine is capable of sorting the COO data and combining multiple entries into a single entry.

View solution in original post

0 Kudos
2 Replies
mecej4
Honored Contributor III
900 Views

You may be able to skip the conversion altogether if the solver allows you to solve ATx = b in the solution phase, because the CSC representation of A is identical to the CSR representation of AT.

You can use a COO ⇒ CSR converter to do a COO ⇒ CSC conversion by interchanging the COO row and column index vectors in the call. A couple of points to consider carefully: COO data may be in arbitrary order, whereas CSC and CSR have to be in prescribed order; COO data may contain multiple entries for any matrix position, and these entries need not appear consecutively. Make sure that the conversion routine is capable of sorting the COO data and combining multiple entries into a single entry.

0 Kudos
Petros
Beginner
899 Views

mecej4 wrote:

You may be able to skip the conversion altogether if the solver allows you to solve ATx = b in the solution phase, because the CSC representation of A is identical to the CSR representation of AT.

You can use a COO ⇒ CSR converter to do a COO ⇒ CSC conversion by interchanging the COO row and column index vectors in the call. A couple of points to consider carefully: COO data may be in arbitrary order, whereas CSC and CSR have to be in prescribed order; COO data may contain multiple entries for any matrix position, and these entries need not appear consecutively. Make sure that the conversion routine is capable of sorting the COO data and combining multiple entries into a single entry.

Thanks! I didn't realize that by swapping row and column of the COO I can get the CSC!

0 Kudos
Reply