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

Sparse matrix coordinate to CSC conversion

Petros
新手
2,421 次查看

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 项奖励
1 解答
mecej4
名誉分销商 III
2,421 次查看

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 项奖励
2 回复数
mecej4
名誉分销商 III
2,422 次查看

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 项奖励
Petros
新手
2,421 次查看

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 项奖励
回复