Class EigenDecompositionImpl
- All Implemented Interfaces:
EigenDecomposition
The eigen decomposition of matrix A is a set of two matrices: V and D such that A = V D VT. A, V and D are all m × m matrices.
As of 2.0, this class supports only symmetric matrices, and
hence computes only real realEigenvalues. This implies the D matrix returned
by getD() is always diagonal and the imaginary values returned
getImagEigenvalue(int) and getImagEigenvalues() are always
null.
When called with a RealMatrix argument, this implementation only uses
the upper part of the matrix, the part below the diagonal is not accessed at
all.
This implementation is based on the paper by A. Drubrulle, R.S. Martin and J.H. Wilkinson 'The Implicit QL Algorithm' in Wilksinson and Reinsch (1971) Handbook for automatic computation, vol. 2, Linear algebra, Springer-Verlag, New-York
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionEigenDecompositionImpl(double[] main, double[] secondary, double splitTolerance) Calculates the eigen decomposition of the symmetric tridiagonal matrix.EigenDecompositionImpl(RealMatrix matrix, double splitTolerance) Calculates the eigen decomposition of the given symmetric matrix. -
Method Summary
Modifier and TypeMethodDescriptiongetD()Returns the block diagonal matrix D of the decomposition.doubleReturn the determinant of the matrixgetEigenvector(int i) Returns a copy of the ith eigenvector of the original matrix.doublegetImagEigenvalue(int i) Returns the imaginary part of the ith eigenvalue of the original matrix.double[]Returns a copy of the imaginary parts of the eigenvalues of the original matrix.doublegetRealEigenvalue(int i) Returns the real part of the ith eigenvalue of the original matrix.double[]Returns a copy of the real parts of the eigenvalues of the original matrix.Get a solver for finding the A × X = B solution in exact linear sense.getV()Returns the matrix V of the decomposition.getVT()Returns the transpose of the matrix V of the decomposition.
-
Constructor Details
-
EigenDecompositionImpl
public EigenDecompositionImpl(RealMatrix matrix, double splitTolerance) throws InvalidMatrixException Calculates the eigen decomposition of the given symmetric matrix.- Parameters:
matrix- The symmetric matrix to decompose.splitTolerance- dummy parameter, present for backward compatibility only.- Throws:
InvalidMatrixException- (wrapping aConvergenceExceptionif algorithm fails to converge
-
EigenDecompositionImpl
public EigenDecompositionImpl(double[] main, double[] secondary, double splitTolerance) throws InvalidMatrixException Calculates the eigen decomposition of the symmetric tridiagonal matrix. The Householder matrix is assumed to be the identity matrix.- Parameters:
main- Main diagonal of the symmetric triadiagonal formsecondary- Secondary of the tridiagonal formsplitTolerance- dummy parameter, present for backward compatibility only.- Throws:
InvalidMatrixException- (wrapping aConvergenceExceptionif algorithm fails to converge
-
-
Method Details
-
getV
Returns the matrix V of the decomposition.V is an orthogonal matrix, i.e. its transpose is also its inverse.
The columns of V are the eigenvectors of the original matrix.
No assumption is made about the orientation of the system axes formed by the columns of V (e.g. in a 3-dimension space, V can form a left- or right-handed system).
- Specified by:
getVin interfaceEigenDecomposition- Returns:
- the V matrix
- Throws:
InvalidMatrixException
-
getD
Returns the block diagonal matrix D of the decomposition.D is a block diagonal matrix.
Real eigenvalues are on the diagonal while complex values are on 2x2 blocks { {real +imaginary}, {-imaginary, real} }.
- Specified by:
getDin interfaceEigenDecomposition- Returns:
- the D matrix
- Throws:
InvalidMatrixException- See Also:
-
getVT
Returns the transpose of the matrix V of the decomposition.V is an orthogonal matrix, i.e. its transpose is also its inverse.
The columns of V are the eigenvectors of the original matrix.
No assumption is made about the orientation of the system axes formed by the columns of V (e.g. in a 3-dimension space, V can form a left- or right-handed system).
- Specified by:
getVTin interfaceEigenDecomposition- Returns:
- the transpose of the V matrix
- Throws:
InvalidMatrixException
-
getRealEigenvalues
Returns a copy of the real parts of the eigenvalues of the original matrix.- Specified by:
getRealEigenvaluesin interfaceEigenDecomposition- Returns:
- a copy of the real parts of the eigenvalues of the original matrix
- Throws:
InvalidMatrixException- See Also:
-
getRealEigenvalue
public double getRealEigenvalue(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException Returns the real part of the ith eigenvalue of the original matrix.- Specified by:
getRealEigenvaluein interfaceEigenDecomposition- Parameters:
i- index of the eigenvalue (counting from 0)- Returns:
- real part of the ith eigenvalue of the original matrix
- Throws:
InvalidMatrixExceptionArrayIndexOutOfBoundsException- See Also:
-
getImagEigenvalues
Returns a copy of the imaginary parts of the eigenvalues of the original matrix.- Specified by:
getImagEigenvaluesin interfaceEigenDecomposition- Returns:
- a copy of the imaginary parts of the eigenvalues of the original matrix
- Throws:
InvalidMatrixException- See Also:
-
getImagEigenvalue
public double getImagEigenvalue(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException Returns the imaginary part of the ith eigenvalue of the original matrix.- Specified by:
getImagEigenvaluein interfaceEigenDecomposition- Parameters:
i- index of the eigenvalue (counting from 0)- Returns:
- imaginary part of the ith eigenvalue of the original matrix
- Throws:
InvalidMatrixExceptionArrayIndexOutOfBoundsException- See Also:
-
getEigenvector
public RealVector getEigenvector(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException Returns a copy of the ith eigenvector of the original matrix.- Specified by:
getEigenvectorin interfaceEigenDecomposition- Parameters:
i- index of the eigenvector (counting from 0)- Returns:
- copy of the ith eigenvector of the original matrix
- Throws:
InvalidMatrixExceptionArrayIndexOutOfBoundsException- See Also:
-
getDeterminant
public double getDeterminant()Return the determinant of the matrix- Specified by:
getDeterminantin interfaceEigenDecomposition- Returns:
- determinant of the matrix
-
getSolver
Get a solver for finding the A × X = B solution in exact linear sense.- Specified by:
getSolverin interfaceEigenDecomposition- Returns:
- a solver
-