|
@@ -8,7 +8,13 @@ using namespace NICE::MatlabConversion;
|
|
|
// b_adaptIndexCtoM: if true, dim k will be inserted as k, not as k+1 (which would be the default for C->M)
|
|
|
mxArray* MatlabConversion::convertSparseVectorFromNice( const NICE::SparseVector & niceSvec, const bool & b_adaptIndexCtoM )
|
|
|
{
|
|
|
- mxArray * matlabSparseVec = mxCreateSparse( niceSvec.getDim() /*m*/, 1/*n*/, niceSvec.size()/*nzmax*/, mxREAL);
|
|
|
+ mxArray * matlabSparseVec;
|
|
|
+
|
|
|
+ if ( b_adaptIndexCtoM )
|
|
|
+ matlabSparseVec = mxCreateSparse( niceSvec.getDim() -1 /*m*/, 1/*n*/, niceSvec.size() -1 /*nzmax*/, mxREAL);
|
|
|
+ else
|
|
|
+ matlabSparseVec = mxCreateSparse( niceSvec.getDim() /*m*/, 1/*n*/, niceSvec.size() /*nzmax*/, mxREAL);
|
|
|
+
|
|
|
|
|
|
// To make the returned sparse mxArray useful, you must initialize the pr, ir, jc, and (if it exists) pi arrays.
|
|
|
// mxCreateSparse allocates space for:
|