public class EigenDecomposition
extends java.lang.Object
The purpose of this class to provide the means to perform Eigen value decomposition of a symmetrical matrix (such as a covariance or a correlation matrix) and get the various associated elements such as the V and the Q matrix.
The sole purpose of this class is strictly to be used within the context of the Principal Components' class and should not be used as a generic Eigen value decomposition class. Generally most of the code has been taken from the EigenDecomposition and TriDiagonalTransformer classes of Apache Commons Math 3.0 with the necessary changes to adhere to the elements of TwoDmatrix and not a RealMatrix.
I redirect anyone interested in Matrices and matrices' decompositions to get Apache Commons Math from http://commons.apache.org/proper/commons-math/ or to try the JAMA package from here : http://math.nist.gov/javanumerics/jama/
| Constructor and Description |
|---|
EigenDecomposition(TwoDmatrix matrix)
Calculates the eigen decomposition of the given symmetric matrix.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getDeterminant()
Computes the determinant of the matrix.
|
double[] |
getEigenvector(int i)
Gets a copy of the ith eigenvector of the original matrix.
|
TwoDmatrix |
getQ()
Returns the matrix Q of the transform.
|
TwoDmatrix |
getQT()
Returns the transpose of the matrix Q of the transform.
|
double |
getRealEigenvalue(int i)
Returns the real part of the ith eigenvalue of the original
matrix.
|
double[] |
getRealEigenvalues()
Gets a copy of the real parts of the eigenvalues of the original matrix.
|
TwoDmatrix |
getV()
Gets the matrix V of the decomposition.
|
void |
TriDiagonalTransformer(TwoDmatrix matrix) |
public EigenDecomposition(TwoDmatrix matrix)
matrix - Matrix to decompose. It must be symmetric.public TwoDmatrix getV()
public TwoDmatrix getQ()
Q is an orthogonal matrix, i.e. its transpose is also its inverse.
public TwoDmatrix getQT()
Q is an orthogonal matrix, i.e. its transpose is also its inverse.
public double[] getRealEigenvalues()
public double getRealEigenvalue(int i)
i - index of the eigenvalue (counting from 0)public double[] getEigenvector(int i)
i - Index of the eigenvector (counting from 0).public double getDeterminant()
public void TriDiagonalTransformer(TwoDmatrix matrix)