Class ComplexSVD

java.lang.Object
com.flag4j.linalg.decompositions.SVD<CMatrix>
com.flag4j.linalg.decompositions.ComplexSVD
All Implemented Interfaces:
Decomposition<CMatrix>

public class ComplexSVD extends SVD<CMatrix>
Instances of this class can be used to compute the singular value decomposition (SVD) of a real dense matrix. That is, decompose a rectangular matrix M as M=USV<sup>H</sup> where U and V are unitary matrices whose columns are the left and right singular vectors of M and S is a rectangular diagonal matrix containing the singular values of M.
  • Field Summary

    Fields inherited from class com.flag4j.linalg.decompositions.SVD

    computeUV, rank, reduced, S, U, V
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a decomposer to compute the singular value decomposition of a real matrix.
    ComplexSVD​(boolean computeUV)
    Creates a decomposer to compute the Schur decomposition.
    ComplexSVD​(boolean computeUV, boolean reduced)
    Creates a decomposer to compute the singular value decomposition of a real matrix.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    extractNormalizedCols​(CMatrix singularVecs, int j)
    Extracts the singular vectors, normalizes them and sets the columns of U and V to be the left/right singular vectors.
    protected void
    initUV​(Shape src, int cols)
    Initializes the unitary U and V matrices for the SVD.
    protected CMatrix
    makeEigenPairs​(CMatrix B, double[] eigVals)
    Gets the eigen values and vectors of symmetric the block matrix which corresponds to the singular values and vectors of the matrix being decomposed.
    protected void
    makeEigenVals​(CMatrix B, double[] eigVals)
    Gets the eigen values of the symmetric block matrix which corresponds to the singular values of the matrix being decomposed.

    Methods inherited from class com.flag4j.linalg.decompositions.SVD

    computeRank, decompose, getRank, getS, getU, getV

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ComplexSVD

      public ComplexSVD()
      Creates a decomposer to compute the singular value decomposition of a real matrix. The left and right singular vectors will be computed.
    • ComplexSVD

      public ComplexSVD(boolean computeUV)
      Creates a decomposer to compute the Schur decomposition.
      Parameters:
      computeUV - A flag which indicates if the unitary matrices Q and V should be computed (i.e. the singular vectors). By default, this is true.
      - If true, the Q and V matrices will be computed.
      - If false, the Q and V matrices will not be computed. If it is not needed, this may provide a performance improvement.
    • ComplexSVD

      public ComplexSVD(boolean computeUV, boolean reduced)
      Creates a decomposer to compute the singular value decomposition of a real matrix.
      Parameters:
      computeUV - A flag which indicates if the orthogonal matrices Q and V should be computed (i.e. the singular vectors). By default, this is true.
      - If true, the Q and V matrices will be computed.
      - If false, the Q and V matrices will not be computed. If they are not needed, this may provide a performance improvement.
      reduced - Flag which indicates if the reduced (or full) SVD should be computed. This is false by default.
      - If true, reduced SVD is computed. - If false, the full SVD is computed.
  • Method Details

    • makeEigenPairs

      protected CMatrix makeEigenPairs(CMatrix B, double[] eigVals)
      Gets the eigen values and vectors of symmetric the block matrix which corresponds to the singular values and vectors of the matrix being decomposed.
      Specified by:
      makeEigenPairs in class SVD<CMatrix>
      Parameters:
      B - Symmetric block matrix to compute the eigenvalues of.
      eigVals - Storage for eigenvalues.
      Returns:
      The eigenvalues and eigenvectors of the symmetric block matrix which corresponds to the singular values and vectors of the matrix being decomposed.
    • makeEigenVals

      protected void makeEigenVals(CMatrix B, double[] eigVals)
      Gets the eigen values of the symmetric block matrix which corresponds to the singular values of the matrix being decomposed.
      Specified by:
      makeEigenVals in class SVD<CMatrix>
      Parameters:
      B - Symmetric block matrix to compute the eigenvalues of.
      eigVals - Storage for eigenvalues.
    • initUV

      protected void initUV(Shape src, int cols)
      Initializes the unitary U and V matrices for the SVD.
      Specified by:
      initUV in class SVD<CMatrix>
      Parameters:
      src - Shape of the source matrix being decomposed.
      cols - The number of columns for U and V.
    • extractNormalizedCols

      protected void extractNormalizedCols(CMatrix singularVecs, int j)
      Extracts the singular vectors, normalizes them and sets the columns of U and V to be the left/right singular vectors.
      Specified by:
      extractNormalizedCols in class SVD<CMatrix>
      Parameters:
      singularVecs - Computed left and right singular vectors.
      j - Index of the column of U and V to set.