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 Details

    • eigenvalues

      public DenseVector eigenvalues()
      The vector of eigenvalues, in descending order.
      Returns:
      The eigenvalues.
    • eigenvectors

      public DenseMatrix eigenvectors()
      The eigenvectors for each eigenvalue, stored in the columns of the matrix.
      Returns:
      A matrix containing the eigenvalues as columns.
    • diagonal

      public DenseVector diagonal()
      The diagonal vector of the tridiagonal form.
      Returns:
      The diagonal vector.
    • offDiagonal

      public DenseVector offDiagonal()
      The off diagonal vector, with the first element set to zero.
      Returns:
      The off diagonal vector.
    • householderMatrix

      public DenseMatrix 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 interface Matrix.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 interface Matrix.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 interface Matrix.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

      public DenseVector getEigenVector(int i)
      Returns the dense vector representing the i'th eigenvector.
      Parameters:
      i - The index.
      Returns:
      The i'th eigenvector.
    • solve

      public DenseVector solve(SGDVector vector)
      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 interface Matrix.Factorization
      Parameters:
      vector - The input vector y.
      Returns:
      The vector b.
    • solve

      public DenseMatrix solve(Matrix matrix)
      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 interface Matrix.Factorization
      Parameters:
      matrix - The input matrix Y.
      Returns:
      The matrix X.