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

NullPointer exception when trying to fetch eigenvalue #38

Open
vsthakur opened this issue Jul 11, 2018 · 3 comments
Open

NullPointer exception when trying to fetch eigenvalue #38

vsthakur opened this issue Jul 11, 2018 · 3 comments

Comments

@vsthakur
Copy link

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();
}

@lessthanoptimal
Copy link
Owner

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?

@vsthakur
Copy link
Author

vsthakur commented Jul 15, 2018

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.

@lessthanoptimal
Copy link
Owner

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.

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

No branches or pull requests

2 participants