Interface SingularValueDecomposition

  • All Known Implementing Classes:
    SingularValueDecompositionImpl

    public interface SingularValueDecomposition
    An interface to classes that implement an algorithm to calculate the Singular Value Decomposition of a real matrix.

    The Singular Value Decomposition of matrix A is a set of three matrices: U, Σ and V such that A = U × Σ × VT. Let A be a m × n matrix, then U is a m × p orthogonal matrix, Σ is a p × p diagonal matrix with positive or null elements, V is a p × n orthogonal matrix (hence VT is also orthogonal) where p=min(m,n).

    This interface is similar to the class with similar name from the JAMA library, with the following changes:

    Since:
    2.0
    See Also:
    MathWorld, Wikipedia
    • Method Detail

      • getU

        RealMatrix getU()
        Returns the matrix U of the decomposition.

        U is an orthogonal matrix, i.e. its transpose is also its inverse.

        Returns:
        the U matrix
        See Also:
        getUT()
      • getUT

        RealMatrix getUT()
        Returns the transpose of the matrix U of the decomposition.

        U is an orthogonal matrix, i.e. its transpose is also its inverse.

        Returns:
        the U matrix (or null if decomposed matrix is singular)
        See Also:
        getU()
      • getS

        RealMatrix getS()
        Returns the diagonal matrix Σ of the decomposition.

        Σ is a diagonal matrix. The singular values are provided in non-increasing order, for compatibility with Jama.

        Returns:
        the Σ matrix
      • getSingularValues

        double[] getSingularValues()
        Returns the diagonal elements of the matrix Σ of the decomposition.

        The singular values are provided in non-increasing order, for compatibility with Jama.

        Returns:
        the diagonal elements of the Σ matrix
      • getV

        RealMatrix getV()
        Returns the matrix V of the decomposition.

        V is an orthogonal matrix, i.e. its transpose is also its inverse.

        Returns:
        the V matrix (or null if decomposed matrix is singular)
        See Also:
        getVT()
      • getVT

        RealMatrix getVT()
        Returns the transpose of the matrix V of the decomposition.

        V is an orthogonal matrix, i.e. its transpose is also its inverse.

        Returns:
        the V matrix (or null if decomposed matrix is singular)
        See Also:
        getV()
      • getCovariance

        RealMatrix getCovariance​(double minSingularValue)
                          throws java.lang.IllegalArgumentException
        Returns the n × n covariance matrix.

        The covariance matrix is V × J × VT where J is the diagonal matrix of the inverse of the squares of the singular values.

        Parameters:
        minSingularValue - value below which singular values are ignored (a 0 or negative value implies all singular value will be used)
        Returns:
        covariance matrix
        Throws:
        java.lang.IllegalArgumentException - if minSingularValue is larger than the largest singular value, meaning all singular values are ignored
      • getNorm

        double getNorm()
        Returns the L2 norm of the matrix.

        The L2 norm is max(|A × u|2 / |u|2), where |.|2 denotes the vectorial 2-norm (i.e. the traditional euclidian norm).

        Returns:
        norm
      • getConditionNumber

        double getConditionNumber()
        Return the condition number of the matrix.
        Returns:
        condition number of the matrix
      • getRank

        int getRank()
        Return the effective numerical matrix rank.

        The effective numerical rank is the number of non-negligible singular values. The threshold used to identify non-negligible terms is max(m,n) × ulp(s1) where ulp(s1) is the least significant bit of the largest singular value.

        Returns:
        effective numerical matrix rank
      • getSolver

        DecompositionSolver getSolver()
        Get a solver for finding the A × X = B solution in least square sense.
        Returns:
        a solver