Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible bug in multidimensional indexing #10

Closed
tmrn411 opened this issue Nov 12, 2016 · 3 comments
Closed

possible bug in multidimensional indexing #10

tmrn411 opened this issue Nov 12, 2016 · 3 comments
Labels

Comments

@tmrn411
Copy link
Contributor

tmrn411 commented Nov 12, 2016

I've been trying to use jmatio to read multi-dimensional arrays created in matlab into a scala app. It appears there is a bug in the way the indices are computed. In the MLArray constructor dimsFactors is initialized from the highest dimension to the lowest, but Matlab arrays are stored in column major format. So I think dimsFactors should really be initialized starting with dimension 0 and going up.

I'm submitting a pull request with more info and proposed fixes.

@nedtwigg
Copy link
Member

For reference #9 is the PR that fixed this issue. Turns out that MatFileRW had multi-dimensional index ordering wrong. For 1D and 2D arrays, everything worked, but it was broken for 3D and higher. If the array happened to be square (e.g. 10x10x10x10) then it still worked, but only by luck.

This is such an important bug that I think it's worth bumping to 3.0.0 to draw attention to the bug and its fix. It's possible that others have already worked-around this bug, so alerting them to the change will let them know to remove their workaround.

@nedtwigg
Copy link
Member

See dfaf131 for full changes. Now implemented in 3.0.0-SNAPSHOT.

@nedtwigg
Copy link
Member

Fixed in 3.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants