ir
就像你猜測的那樣,是非空行的行索引。對於列索引,事情有點複雜,但在Mathworks mex-Function文檔中完整記錄。
從http://www.mathworks.de/de/help/matlab/apiref/mxsetir.html粘貼:
If the jth column of the sparse mxArray has any nonzero elements:
jc[j] is the index in ir, pr, and pi (if it exists) of the first nonzero element in the jth column.
jc[j+1]-1 is the index of the last nonzero element in the jth column.
For the jth column of the sparse matrix, jc[j] is the total number of nonzero elements in all preceding columns.
The number of nonzero elements in the jth column of the sparse mxArray is:
jc[j+1] - jc[j];
還要檢查mxSetIr
的機制的文檔。 假設您也可以訪問matlab,您應該檢查從文檔鏈接的mex示例。
非常感謝您的回答。 – hanqiang