- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello everyone. I need to convert a non-square sparse matrix (m x n) from CSR format to CSC. But MKL has routines only for square matrix (m x m): mkl_?csrcsc. What can I try to make to complete this my own operation which is equivalent transpose operation for dense matrix? Thanks.
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
To obtain transpose of non-square matrix
I used "mkl_?csradd" function with trans = 'T' and zero-matrix.
This is not efficient. Any other way?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
To convert from CSR to CSC or, which is equivalent, to find the CSR representation of AT given the CSR representation of the sparse rectangular matrix A of size m X n, one simple way involves (i) conceptually padding up the matrix with additional zero entries to a square matrix of size N X N where N = max (m,n), and (ii) calling the MKL converter.
Note that, in the 3-array CSR representation, no changes need to be made to the values or columns arrays (and, when m > n, to rowIndex) as a result of the padding-up, since none of the padding elements is non-zero. If m < n, the rowIndex array should be padded up by replicating the prior last value, i.e., nnz+1.
If m and n differ from each other so much that you are concerned about the wasted CPU cycles devoted to processing the additional zeros used to pad the matrix, you can write your own converter routine, noting that if log2 nnz is significantly less than max (m,n) it may be worthwhile to sort the values and columns arrays by column indices before computing the 3-array representation of the transpose.