Open vsthakur opened 6 years ago
I think you have an imaginary eigenvalue in your dense real matrix. Those are currently not handled. Have a better idea for how to notify the user of the problem?
DMatrixRMaj_data.txt Hi, PFA the data matrix file. Matrix is symmetric and real. Expect the eigenvalues to be real in this case. Octave gives real eigenvalues for this matrix.
Thanks for the data file. Any chance you can run it through Eigen? I'm planning on revisiting the algorithm used in EJML and curious if their implementation handles it better. I looked at it and I think I know which book they were reading when they implemented it.
I get the following exception when trying to fetch eigenvalue of a symmetric matrix:
Exception in thread "main" java.lang.NullPointerException at org.ejml.dense.row.decomposition.eig.SymmetricQRAlgorithmDecomposition_DDRM.getEigenvalue(SymmetricQRAlgorithmDecomposition_DDRM.java:118) at org.ejml.dense.row.decomposition.eig.SwitchingEigenDecomposition_DDRM .getEigenvalue(SwitchingEigenDecomposition_DDRM.java:74)
Below is my code snippet: EigenDecomposition_F64 factory = DecompositionFactory_DDRM
.eig(inputDim, true);
DMatrixRMaj covMat = new DMatrixRMaj(covArr);
factory.decompose(covMat);
Double[] eigenVals = new Double[inputDim];
for (int i = 0; i < inputDim; i++) {
eigenVals[i] = factory.getEigenvalue(i).getReal();
}