Closed jinz2014 closed 11 months ago
Yes, cuSPARSE provides cusparseCsr2cscEx2()
https://docs.nvidia.com/cuda/cusparse/index.html#cusparsecsr2cscex2 to transpose a CSR matrix to CSC (which is CSR with columns/rows swapped).
I suppose that users need to convert the outputs in CSC to the outputs in CSR after calling cusparseCsr2cscEx2(). Thanks.
I have a follow-up question. Will cuSparse consider adding a function whose output is also in CSR format ?
Hi @jinz2014. Sorry, I don't get your question. A matrix in CSR is equivalent to its transposed matrix stored in CSC. You can think of the output of cusparseCsr2cscEx2()
as a CSR matrix; then, this function acts as a transpose operation.
Suppose the input matrix is "m" rows and "n" cols. After the transpose operation, the output matrix is "n" rows and "m" cols. When the output is stored in CSC, the "csrColPtr" array contains "m+1" elements. However, the document shows correctly that it contains "n+1" elements. Do you think the document could say that the output is still a CSR matrix (like the description of the Intel sparse omatcopy). This may be clearer to users of the function. Thanks.
cscColPtr | Integer array of size n + 1 that containes the CSC column offsets -- | --In the document, it is said that "The resulting matrix can also be seen as the transpose of the original sparse matrix."
Yes, I agree we should make it clearer that it's a transpose if we see the output as a CSR matrix (i.e. cscColPtr
is used as csrRowPtr
).
Is there a cuSparse function that transposes a sparse matrix in CSR to another one in CSR ? Thanks.
Reference https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-dpcpp/2023-1/oneapi-mkl-sparse-omatcopy.html