fozziethebeat / S-Space

The S-Space repsitory, from the AIrhead-Research group
GNU General Public License v2.0
205 stars 106 forks source link

Matrix Transformation produces strange Floatingpoint values with commas #53

Open LauraS2 opened 10 years ago

LauraS2 commented 10 years ago

Dear Developers,

I'm using a library that calls edu.ucla.sspace.matrix.SVD.svd(File matrix, Algorithm alg, Format format, int dimensions) to perform a SVD. However, during the execution a java.lang.NumberFormatException occurs on the String "0,273696". Obviously, the comma is causing the problem. But how the comma comes to exist in the first place is unclear to me. The algorithm to use is ANY.

The error: Exception in thread "main" java.lang.NumberFormatException: For input string: "0,273696" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241) at java.lang.Double.parseDouble(Double.java:540) at edu.ucla.sspace.matrix.MatrixIO.readMatlabSparse(MatrixIO.java:1136) at edu.ucla.sspace.matrix.MatrixIO.readMatrix(MatrixIO.java:798) at edu.ucla.sspace.matrix.MatrixIO.readMatrix(MatrixIO.java:723) at edu.ucla.sspace.matrix.MatrixIO.readMatrixArray(MatrixIO.java:697) at edu.ucla.sspace.matrix.SVD.svd(SVD.java:426) at edu.ucla.sspace.matrix.SVD.svd(SVD.java:430) ...

So far I was able to trace the origin of the error to the transformation of a matrix. The matrix itself looks fine. But the transformed variant suddenly contains floatingpoint values with commas instead of points.

The normal matrix: matrix The transformed matrix: transformedmatrix

The Transformation is called in this fashion:

import edu.ucla.sspace.matrix.Transform; ... Transform transform = new LogEntropyTransform(); File transformedMatrix = transform.transform(termDocumentMatrix, termDocumentMatrixBuilder.getMatrixFormat());

I hope you can help me.

Yours, Laura