|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.linear.EigenDecompositionImpl
public class EigenDecompositionImpl
Calculates the eigen decomposition of a symmetric matrix.
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.
Eigenvalues are computed as soon as the matrix is decomposed, but eigenvectors
are computed only when required, i.e. only when one of the getEigenvector(int)
,
getV()
, getVT()
, getSolver()
methods is called.
This implementation is based on Inderjit Singh Dhillon thesis A New O(n2) Algorithm for the Symmetric Tridiagonal Eigenvalue/Eigenvector Problem, on Beresford N. Parlett and Osni A. Marques paper An Implementation of the dqds Algorithm (Positive Case) and on the corresponding LAPACK routines (DLARRE, DLASQ2, DLAZQ3, DLAZQ4, DLASQ5 and DLASQ6).
Constructor Summary | |
---|---|
EigenDecompositionImpl(double[] main,
double[] secondary,
double splitTolerance)
Calculates the eigen decomposition of the given tridiagonal symmetric matrix. |
|
EigenDecompositionImpl(RealMatrix matrix,
double splitTolerance)
Calculates the eigen decomposition of the given symmetric matrix. |
Method Summary | |
---|---|
RealMatrix |
getD()
Returns the block diagonal matrix D of the decomposition. |
double |
getDeterminant()
Return the determinant of the matrix |
RealVector |
getEigenvector(int i)
Returns a copy of the ith eigenvector of the original matrix. |
double |
getImagEigenvalue(int i)
Returns the imaginary part of the ith eigenvalue of the original matrix. |
double[] |
getImagEigenvalues()
Returns a copy of the imaginary parts of the eigenvalues of the original matrix. |
double |
getRealEigenvalue(int i)
Returns the real part of the ith eigenvalue of the original matrix. |
double[] |
getRealEigenvalues()
Returns a copy of the real parts of the eigenvalues of the original matrix. |
DecompositionSolver |
getSolver()
Get a solver for finding the A × X = B solution in exact linear sense. |
RealMatrix |
getV()
Returns the matrix V of the decomposition. |
RealMatrix |
getVT()
Returns the transpose of the matrix V of the decomposition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EigenDecompositionImpl(RealMatrix matrix, double splitTolerance) throws InvalidMatrixException
matrix
- The symmetric matrix to decompose.splitTolerance
- tolerance on the off-diagonal elements relative to the
geometric mean to split the tridiagonal matrix (a suggested value is
MathUtils.SAFE_MIN
)
InvalidMatrixException
- (wrapping a ConvergenceException
if algorithm fails to convergepublic EigenDecompositionImpl(double[] main, double[] secondary, double splitTolerance) throws InvalidMatrixException
main
- the main diagonal of the matrix (will be copied)secondary
- the secondary diagonal of the matrix (will be copied)splitTolerance
- tolerance on the off-diagonal elements relative to the
geometric mean to split the tridiagonal matrix (a suggested value is
MathUtils.SAFE_MIN
)
InvalidMatrixException
- (wrapping a ConvergenceException
if algorithm fails to convergeMethod Detail |
---|
public RealMatrix getV() throws InvalidMatrixException
V is an orthogonal matrix, i.e. its transpose is also its inverse.
The columns of V are the eigenvectors of the original matrix.
getV
in interface EigenDecomposition
InvalidMatrixException
public RealMatrix getD() throws InvalidMatrixException
D is a block diagonal matrix.
Real eigenvalues are on the diagonal while complex values are on 2x2 blocks { {real +imaginary}, {-imaginary, real} }.
getD
in interface EigenDecomposition
InvalidMatrixException
EigenDecomposition.getRealEigenvalues()
,
EigenDecomposition.getImagEigenvalues()
public RealMatrix getVT() throws InvalidMatrixException
V is an orthogonal matrix, i.e. its transpose is also its inverse.
The columns of V are the eigenvectors of the original matrix.
getVT
in interface EigenDecomposition
InvalidMatrixException
public double[] getRealEigenvalues() throws InvalidMatrixException
getRealEigenvalues
in interface EigenDecomposition
InvalidMatrixException
EigenDecomposition.getD()
,
EigenDecomposition.getRealEigenvalue(int)
,
EigenDecomposition.getImagEigenvalues()
public double getRealEigenvalue(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException
getRealEigenvalue
in interface EigenDecomposition
i
- index of the eigenvalue (counting from 0)
InvalidMatrixException
ArrayIndexOutOfBoundsException
EigenDecomposition.getD()
,
EigenDecomposition.getRealEigenvalues()
,
EigenDecomposition.getImagEigenvalue(int)
public double[] getImagEigenvalues() throws InvalidMatrixException
getImagEigenvalues
in interface EigenDecomposition
InvalidMatrixException
EigenDecomposition.getD()
,
EigenDecomposition.getImagEigenvalue(int)
,
EigenDecomposition.getRealEigenvalues()
public double getImagEigenvalue(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException
getImagEigenvalue
in interface EigenDecomposition
i
- index of the eigenvalue (counting from 0)
InvalidMatrixException
ArrayIndexOutOfBoundsException
EigenDecomposition.getD()
,
EigenDecomposition.getImagEigenvalues()
,
EigenDecomposition.getRealEigenvalue(int)
public RealVector getEigenvector(int i) throws InvalidMatrixException, ArrayIndexOutOfBoundsException
getEigenvector
in interface EigenDecomposition
i
- index of the eigenvector (counting from 0)
InvalidMatrixException
ArrayIndexOutOfBoundsException
EigenDecomposition.getD()
public double getDeterminant()
getDeterminant
in interface EigenDecomposition
public DecompositionSolver getSolver()
getSolver
in interface EigenDecomposition
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |