- 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.double
getRealEigenvalue
(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.boolean
Returns whether the calculated eigenvalues are complex or real.boolean
Returns true if the eigenvalue problem is degenerate (i.e., ill-posed).boolean
This 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:
getRealEigenvalues
in interfaceRealEigenDecomposition
- Returns:
- the real parts of the eigenvalues
-
getRealEigenvalue
Description copied from interface:RealEigenDecomposition
Returns the real part of the k-th eigenvalue- Specified by:
getRealEigenvalue
in 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:
getV
in interfaceRealEigenDecomposition
- Returns:
- the matrix of eigenvectors
-
getEigenvector
Returns the specified eigenvector.- Specified by:
getEigenvector
in 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 returnstrue
if any element is not equal to zero.- Specified by:
hasComplexEigenvalues
in interfaceRealEigenDecomposition
- Returns:
true
if any of the eigenvalues is complex,false
otherwise
-
getD
Returns the block diagonal eigenvalue matrix D.- Specified by:
getD
in 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
-