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