在将MKL C++代码做MATLAB接口的过程中遇到一个小问题总是运行出错,今天终于解决,记录下来:
mxArray* aa = mxCreateSparse(num_of_feature, model->l, nonzero_element, mxREAL);
ptr = mxGetPr(aa);
jc = mxGetJc(aa);
ir = mxGetIr(aa);
代码在64位机子上mex后运行会出错,解决方法:
64-bit mex files using sparse matrices must be rebuilt with the "-largeArrayDims" option. See the R2006b release
notes for more details.
> mex -largeArrayDims mkl-train.cpp