tbeu / matio

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

mat_sparse_t should be extended to manage 64 bits index #102

Open Nelson-numerical-software opened 5 years ago

Nelson-numerical-software commented 5 years ago

nzmax, ir, jc should be uint64 and not int32 v7.3 matfile uses uint64 and not int32 index

tbeu commented 5 years ago

Confirmed, the design of the mat_sparse_t structures is broken w.r.t. the dimension types.

Furthermore, there is no need to store isComplex, isGlobal, isLogical and mem_conserve as int32 in matvar_t. This would save 12 bytes out of the 72 bytes of matvar_t.

Unfortunately, both changes are not backward-compatibel and so far I am not sure if it is a good idea to break compatibility. There are tools out there (e.g., C# wrappers) that depend on a certain memory layout of both structures.

Nelson-numerical-software commented 5 years ago

Unfortunately, both changes are not backward-compatibel and so far I am not sure if it is a good idea to break compatibility. There are tools out there (e.g., C# wrappers) that depend on a certain memory layout of both structures.

With an compilation flags, it should be possible to choose indexing mode. 64 bit indexing for sparse is available since 2006.

tbeu commented 5 years ago

Which leaves the question, what to make the default case.

Nelson-numerical-software commented 5 years ago

It could be something as: