Finding CRS format of matrix in Mex

조회 수: 6 (최근 30일)
Abhishek
Abhishek 2012년 7월 6일
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
James Tursa 2012년 7월 8일
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
Abhishek 2012년 7월 8일
Thanks for reply. I have to perform some operation on sparse matrices in CUDA. For that I need first matrix in CRS format. So transposing it might increase the runtime since I have to deal with sparse matrices with million non zeros. I think I will have to use some library that might help in finding the CSR format.
  댓글 수: 3
Abhishek
Abhishek 2012년 7월 8일
James,
Yes I am fully aware of the reversal of roles of col_ptrs into row_ptrs and row_indices into col_indices when we transpose it. What I want is to transpose it inside the mex routine that I am writing. And yes there are facilities in CUDA that I have tried which allow us to change the format from CSC to CSR. cuSPARSE and CUSP are two such examples of libraries.I guess, I will have to use one of them.
Thanks again.
James Tursa
James Tursa 2012년 7월 8일
You can use mexCallMATLAB with your MATLAB variable as the input and call the "transpose" function.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by