Package org.tribuo.math.la
Class DenseMatrix.EigenDecomposition
java.lang.Object
org.tribuo.math.la.DenseMatrix.EigenDecomposition
- All Implemented Interfaces:
Matrix.Factorization
- Enclosing class:
- DenseMatrix
public static final class DenseMatrix.EigenDecomposition
extends Object
implements Matrix.Factorization
The output of a successful eigen decomposition.
Wraps a dense vector containing the eigenvalues and a dense matrix containing the eigenvectors as columns. Mutating these fields will cause undefined behaviour.
Also has fields representing the tridiagonal form used as an intermediate step in the eigen decomposition.
May be refactored into a record in the future.
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Computes the determinant of the matrix which was decomposed.diagonal()
The diagonal vector of the tridiagonal form.int
dim1()
First dimension of the factorized matrix.int
dim2()
Second dimension of the factorized matrix.The vector of eigenvalues, in descending order.The eigenvectors for each eigenvalue, stored in the columns of the matrix.getEigenVector
(int i) Returns the dense vector representing the i'th eigenvector.The Householder matrix produced during the tridiagonalisation.boolean
Returns true if all the eigenvalues are non-zero.The off diagonal vector, with the first element set to zero.boolean
Returns true if all the eigenvalues are positive.Solves the system A * X = Y, where Y is the input matrix, and A is the matrix which produced this eigen decomposition.Solves a system of linear equations A * b = y, where y is the input vector, A is the matrix which produced this eigen decomposition, and b is the returned value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.math.la.Matrix.Factorization
inverse
-
Method Details
-
eigenvalues
The vector of eigenvalues, in descending order.- Returns:
- The eigenvalues.
-
eigenvectors
The eigenvectors for each eigenvalue, stored in the columns of the matrix.- Returns:
- A matrix containing the eigenvalues as columns.
-
diagonal
The diagonal vector of the tridiagonal form.- Returns:
- The diagonal vector.
-
offDiagonal
The off diagonal vector, with the first element set to zero.- Returns:
- The off diagonal vector.
-
householderMatrix
The Householder matrix produced during the tridiagonalisation.- Returns:
- The Householder matrix.
-
dim1
public int dim1()Description copied from interface:Matrix.Factorization
First dimension of the factorized matrix.- Specified by:
dim1
in interfaceMatrix.Factorization
- Returns:
- First dimension size.
-
dim2
public int dim2()Description copied from interface:Matrix.Factorization
Second dimension of the factorized matrix.- Specified by:
dim2
in interfaceMatrix.Factorization
- Returns:
- Second dimension size.
-
determinant
public double determinant()Computes the determinant of the matrix which was decomposed.This is the product of the eigenvalues.
- Specified by:
determinant
in interfaceMatrix.Factorization
- Returns:
- The determinant.
-
positiveEigenvalues
public boolean positiveEigenvalues()Returns true if all the eigenvalues are positive.- Returns:
- True if the eigenvalues are positive.
-
nonSingular
public boolean nonSingular()Returns true if all the eigenvalues are non-zero.- Returns:
- True if the eigenvalues are non-zero (i.e. the matrix is not singular).
-
getEigenVector
Returns the dense vector representing the i'th eigenvector.- Parameters:
i
- The index.- Returns:
- The i'th eigenvector.
-
solve
Solves a system of linear equations A * b = y, where y is the input vector, A is the matrix which produced this eigen decomposition, and b is the returned value.- Specified by:
solve
in interfaceMatrix.Factorization
- Parameters:
vector
- The input vector y.- Returns:
- The vector b.
-
solve
Solves the system A * X = Y, where Y is the input matrix, and A is the matrix which produced this eigen decomposition.- Specified by:
solve
in interfaceMatrix.Factorization
- Parameters:
matrix
- The input matrix Y.- Returns:
- The matrix X.
-