vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
371 stars 109 forks source link

Symmetric matrix are not recognized using fromMatrixMarket #295

Open LsKoder opened 6 years ago

LsKoder commented 6 years ago

There is any reason for this part of code?

String symmetry = header.nextToken();
if (!symmetry.equals("general")) {
    throw new IllegalArgumentException("Unknown symmetry type: " + symmetry + ".");
}

It generates this error, loading the following matrix: https://sparse.tamu.edu/Janna/Flan_1565

Exception in thread "main" java.lang.IllegalArgumentException: Unknown symmetry type: symmetric.
    at org.la4j.Matrix.fromMatrixMarket(Matrix.java:232)
    at org.la4j.matrix.SparseMatrix.fromMatrixMarket(SparseMatrix.java:134)
    at Main.main(Main.java:22)
vkostyukov commented 5 years ago

Thanks for the ticket @LsKoder! Is symmetric a part of the MatrixMarket format spec? Also, maybe you want to work on a fix?

LsKoder commented 5 years ago

Thanks for the ticket @LsKoder! Is symmetric a part of the MatrixMarket format spec? Also, maybe you want to work on a fix?

About symmetric type, I catched that exception from these files: https://sparse.tamu.edu/Janna/Flan_1565 https://sparse.tamu.edu/MaxPlanck/shallow_water1

Btw, the MM documentation describes the format as following: "As an example of the type field, RSA denotes that the matrix is real, symmetric, and assembled" Link: https://math.nist.gov/MatrixMarket/formats.html But continuing to read the document, it describes the third line as "3 chars". So, I think that the "Symmetric" string could be an error into "sparse.tamu.edu" files.