Finding CRS format of matrix in Mex
이전 댓글 표시
Hi,
I am using mex bridge to perform some operations sparse matrices from matlab.One of the operations requires me to convert matrix from CSC to CRS format. I was able to get values and col_indices arrays. However, I am not able to understand the exact method by which I can extract row_pointers array of a given matrix in CSC format.
Any help/suggestions will be appreciated.
Thanks in advance.
Cheers.
답변 (2개)
James Tursa
2012년 7월 8일
0 개 추천
Can't you just transpose it within MATLAB, and then treat the resulting row indexes as column indexes and column "pointers" as row "pointers" in the CRS format?
Abhishek
2012년 7월 8일
0 개 추천
댓글 수: 3
James Tursa
2012년 7월 8일
편집: James Tursa
2012년 7월 8일
The CSC format that MATLAB uses stores the data in column order. As I understand it, the CSR format stores the data in row order. You will never get the MATLAB data into a routine (e.g., your CUDA) expecting the data in row order without transposing it. Does your CUDA routine have any options for using the transpose of the input w/o physically doing the transpose up front? Also, I think you misunderstood my first reply. The physical transpose of the CSC format is the CSR format ... i.e. transposing it does the conversion for you. You don't need a separate routine for this. You just need to interpret the resulting row indexes as column indexes, and treat the resulting column pointers as row pointers.
Abhishek
2012년 7월 8일
James Tursa
2012년 7월 8일
You can use mexCallMATLAB with your MATLAB variable as the input and call the "transpose" function.
카테고리
도움말 센터 및 File Exchange에서 GPU Computing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!