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

MM-Format IO Checking #1627

Closed
MarcelKoch opened this issue Jun 18, 2024 · 1 comment · Fixed by #1628
Closed

MM-Format IO Checking #1627

MarcelKoch opened this issue Jun 18, 2024 · 1 comment · Fixed by #1628

Comments

@MarcelKoch
Copy link
Member

Reading an MM-file doesn't check the file itself for consistency. For example, if the MM file defines a 6x4 matrix, but less then 24 lines after the size definition contain values, not all values of the created matrix/vector will be filled.
IMO there should be a simple test that after a definition of a MxN dense matrix, exactly M * N lines should contain a value.
This checking would not apply to the coordinate format, as missing values will be assumed to be zero anyway.

@MarcelKoch
Copy link
Member Author

Actually, this is already checked.
But the issue remains if the MM-file contains multiple values per line. Then each value in a row seems to be interpreted as being on a row by itself. Thus the value is not interpreted as the next column value, but instead as a value for the next row.

Consider this file:

%%MatrixMarket matrix array real general
4 2
1 1
2 2
3 3
4 4

Then reading and writing it again one would expect (without deeper knowledge of the MM standard) the matrix entries in a single list using column major format:

%%MatrixMarket matrix array real general
4 2
1
2
3
4
1
2
3
4

But instead one gets

%%MatrixMarket matrix array real general
4 2
1
1
2
2
3
3
4
4

@MarcelKoch MarcelKoch linked a pull request Jun 19, 2024 that will close this issue
MarcelKoch added a commit that referenced this issue Aug 14, 2024
This PR will discard any character in a line of a MM-format file after the values have been read in. This addresses #1627, using multiple columns within the MM-file will now lead to an exception. However, the exception is thrown by the `read_entry` function and thus the exception message is not very helpful.

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

Successfully merging a pull request may close this issue.

1 participant