tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
330 stars 97 forks source link

sparse nzmax replaced by nnz by matio ? #106

Closed Nelson-numerical-software closed 5 years ago

Nelson-numerical-software commented 5 years ago
S = sparse(1:10,1:10,5,20,20,100);
nzmax(S)
save('bug_nzmax.mat','S','-v7.3')

loaded by matio:

mat_sparse_t* sparseData = (mat_sparse_t*)matVariable->data;
indexType nzmax = (indexType)sparseData->nzmax;

nzmax from matio is equal to 10 and not 100 as expected.

Same problem when we save with matio and load after

tbeu commented 5 years ago

Confirmed (only with v7.3), see https://github.com/tbeu/matio/blob/2c20d2178017b3eb13ab160cef239648f9915bdb/src/mat73.c#L2455-L2456 Can you please attach the MAT-file here.

tbeu commented 5 years ago

nzmax is not stored in the v7.3 MAT file, thus impossible to consider it correctly.