Class EigenDecompositionNonSymmetric
The eigen decomposition of matrix A is a set of two matrices: \(V\) and \(D\) such that \(A V = V D\) where $\(A\), \(V\) and \(D\) are all \(m \times m\) matrices.
This class is similar in spirit to the EigenvalueDecomposition
class from the JAMA
library, with the following changes:
- a
getVInv
method has been added, - z
getEigenvalue
method to pick up a single eigenvalue has been added, - a
getEigenvector
method to pick up a single eigenvector has been added, - a
getDeterminant
method has been added.
This class supports non-symmetric matrices, which have complex eigenvalues.
Support for symmetric matrices is provided by EigenDecompositionSymmetric
.
As \(A\) is not symmetric, then the eigenvalue matrix \(D\) is block diagonal with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, \(\lambda \pm i \mu\), in 2-by-2 blocks:
\[ \begin{bmatrix} \lambda & \mu\\ -\mu & \lambda \end{bmatrix} \]
The columns of \(V\) represent the eigenvectors in the sense that \(A V = V D\),
i.e. A.multiply(V)
equals V.multiply(D)
.
The matrix \(V\) may be badly conditioned, or even singular, so the validity of the
equation \(A = V D V^{-1}\) depends upon the condition of \(V\).
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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
Default epsilon value to use for internal epsilon -
Constructor Summary
ConstructorDescriptionCalculates the eigen decomposition of the given real matrix.EigenDecompositionNonSymmetric
(RealMatrix matrix, double epsilon) Calculates the eigen decomposition of the given real matrix. -
Method Summary
Modifier and TypeMethodDescriptiongetD()
Gets the block diagonal matrix D of the decomposition.Computes the determinant of the matrix.getEigenvalue
(int i) Returns the ith eigenvalue of the original matrix.Complex[]
Gets a copy of the eigenvalues of the original matrix.getEigenvector
(int i) Gets a copy of the ith eigenvector of the original matrix.double
Get's the value for epsilon which is used for internal tests (e.g.getV()
Gets the matrix V of the decomposition.getVInv()
Gets the inverse of the matrix V of the decomposition.
-
Field Details
-
DEFAULT_EPSILON
public static final double DEFAULT_EPSILONDefault epsilon value to use for internal epsilon- See Also:
-
-
Constructor Details
-
EigenDecompositionNonSymmetric
Calculates the eigen decomposition of the given real matrix.- Parameters:
matrix
- Matrix to decompose.- Throws:
MathIllegalStateException
- if the algorithm fails to converge.MathRuntimeException
- if the decomposition of a general matrix results in a matrix with zero norm
-
EigenDecompositionNonSymmetric
public EigenDecompositionNonSymmetric(RealMatrix matrix, double epsilon) throws MathRuntimeException Calculates the eigen decomposition of the given real matrix.- Parameters:
matrix
- Matrix to decompose.epsilon
- Epsilon used for internal tests (e.g. is singular, eigenvalue ratio, etc.)- Throws:
MathIllegalStateException
- if the algorithm fails to converge.MathRuntimeException
- if the decomposition of a general matrix results in a matrix with zero norm
-
-
Method Details
-
getV
Gets the matrix V of the decomposition. V is a matrix whose columns hold either the real or the imaginary part of eigenvectors.- Returns:
- the V matrix.
-
getD
Gets 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} }.- Returns:
- the D matrix.
-
getEpsilon
public double getEpsilon()Get's the value for epsilon which is used for internal tests (e.g. is singular, eigenvalue ratio, etc.)- Returns:
- the epsilon value.
-
getVInv
Gets the inverse of the matrix V of the decomposition.- Returns:
- the inverse of the V matrix.
-
getEigenvalues
Gets a copy of the eigenvalues of the original matrix.- Returns:
- a copy of the eigenvalues of the original matrix.
- See Also:
-
getEigenvalue
Returns the ith eigenvalue of the original matrix.- Parameters:
i
- index of the eigenvalue (counting from 0)- Returns:
- ith eigenvalue of the original matrix.
- See Also:
-
getEigenvector
Gets a copy of the ith eigenvector of the original matrix.Note that if the the ith is complex this method will throw an exception.
- Parameters:
i
- Index of the eigenvector (counting from 0).- Returns:
- a copy of the ith eigenvector of the original matrix.
- See Also:
-
getDeterminant
Computes the determinant of the matrix.- Returns:
- the determinant of the matrix.
-