- All Implemented Interfaces:
RealEigenDecomposition
Solves the generalized eigenproblem of the form A x = λ B x, for square matrices A, B.
This implementation was ported from original EISPACK code [1] using a finite state machine concept [2] to untangle
Fortran's GOTO statements (which are not available in Java), with some inspirations from this
C# implementation. See
mipav.cit.nih.gov (file
gov.nih.mipav.model.structures.jama.GeneralizedEigenvalue.java) for another Java implementation based on
EISPACK.
Note: Results have limited accuracy. For some reason the first eigenvalue/-vector (k=0) is reasonably accurate, but
the remaining ones are not. If matrices A, B are symmetric and B is positive definite, better use
GeneralizedSymmetricEigenDecomposition instead, which is more accurate.
[1] http://www.netlib.no/netlib/eispack/
[2] D. E. Knuth, "Structured Programming with Goto Statements",
Computing Surveys, Vol. 6, No. 4 (1974).
- Version:
- 2022/12/22
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeneralizedEigenDecomposition(double[][] A, double[][] B) Constructor, solves the generalized eigenproblem A x = λ B x, for square matrices A, B.Constructor, solves the generalized eigenproblem A x = λ B x, for square matrices A, B. -
Method Summary
Modifier and TypeMethodDescriptiongetD()Returns the block diagonal eigenvalue matrix D.getEigenvector(int k) Returns the specified eigenvector.double[]Returns a vector with the imaginary parts of the eigenvalues.doublegetRealEigenvalue(int k) Returns the real part of the k-th eigenvaluedouble[]Returns a vector with the real parts of the eigenvalues.getV()Return the matrix of eigenvectors, which are its column vectors.booleanReturns whether the calculated eigenvalues are complex or real.booleanReturns true if the eigenvalue problem is degenerate (i.e., ill-posed).booleanThis method checks if any of the generated betas is zero.
-
Field Details
-
VERBOSE
-
-
Constructor Details
-
GeneralizedEigenDecomposition
Constructor, solves the generalized eigenproblem A x = λ B x, for square matrices A, B.- Parameters:
A- square matrix AB- square matrix B
-
GeneralizedEigenDecomposition
Constructor, solves the generalized eigenproblem A x = λ B x, for square matrices A, B.- Parameters:
A- square matrix AB- square matrix B
-
-
Method Details
-
getRealEigenvalues
Returns a vector with the real parts of the eigenvalues.- Specified by:
getRealEigenvaluesin interfaceRealEigenDecomposition- Returns:
- the real parts of the eigenvalues
-
getRealEigenvalue
Description copied from interface:RealEigenDecompositionReturns the real part of the k-th eigenvalue- Specified by:
getRealEigenvaluein interfaceRealEigenDecomposition- Parameters:
k- index of the eigenvalue @param k index of the eigenvector (0-based)- Returns:
- real part of the k-th eigenvalue
-
getImagEigenvalues
Returns a vector with the imaginary parts of the eigenvalues.- Returns:
- the imaginary parts of the eigenvalues
-
getV
Return the matrix of eigenvectors, which are its column vectors.- Specified by:
getVin interfaceRealEigenDecomposition- Returns:
- the matrix of eigenvectors
-
getEigenvector
Returns the specified eigenvector.- Specified by:
getEigenvectorin interfaceRealEigenDecomposition- Parameters:
k- index- Returns:
- the kth eigenvector
-
hasComplexEigenvalues
Returns whether the calculated eigenvalues are complex or real. The method performs a zero check on each element of thegetImagEigenvalues()array and returnstrueif any element is not equal to zero.- Specified by:
hasComplexEigenvaluesin interfaceRealEigenDecomposition- Returns:
trueif any of the eigenvalues is complex,falseotherwise
-
getD
Returns the block diagonal eigenvalue matrix D.- Specified by:
getDin interfaceRealEigenDecomposition- Returns:
- the block diagonal eigenvalue matrix
-
isSingular
This method checks if any of the generated betas is zero. It does not says that the problem is singular, but only that one of the matrices A, B is singular.- Returns:
- true if A or B is singular
-
IsDegenerate
Returns true if the eigenvalue problem is degenerate (i.e., ill-posed).- Returns:
- true if degenerate
-