Class SymmetricQRAlgorithmDecomposition_DDRM

All Implemented Interfaces:
DecompositionInterface<DMatrixRMaj>, EigenDecomposition<DMatrixRMaj>, EigenDecomposition_F64<DMatrixRMaj>

public class SymmetricQRAlgorithmDecomposition_DDRM
extends Object
implements EigenDecomposition_F64<DMatrixRMaj>

Computes the eigenvalues and eigenvectors of a real symmetric matrix using the symmetric implicit QR algorithm. Inside each iteration a QR decomposition of Ai-piI is implicitly computed.

This implementation is based on the algorithm is sketched out in:
David S. Watkins, "Fundamentals of Matrix Computations," Second Edition. page 377-385

See Also:
SymmetricQrAlgorithm_DDRM, TridiagonalDecompositionHouseholder_DDRM
  • Constructor Details

    • SymmetricQRAlgorithmDecomposition_DDRM

      public SymmetricQRAlgorithmDecomposition_DDRM​(TridiagonalSimilarDecomposition_F64<DMatrixRMaj> decomp, boolean computeVectors)
    • SymmetricQRAlgorithmDecomposition_DDRM

      public SymmetricQRAlgorithmDecomposition_DDRM​(boolean computeVectors)
  • Method Details

    • setComputeVectorsWithValues

      public void setComputeVectorsWithValues​(boolean computeVectorsWithValues)
    • setMaxIterations

      public void setMaxIterations​(int max)
      Used to limit the number of internal QR iterations that the QR algorithm performs. 20 should be enough for most applications.
      max - The maximum number of QR iterations it will perform.
    • getNumberOfEigenvalues

      public int getNumberOfEigenvalues()
      Description copied from interface: EigenDecomposition
      Returns the number of eigenvalues/eigenvectors. This is the matrix's dimension.
      Specified by:
      getNumberOfEigenvalues in interface EigenDecomposition<DMatrixRMaj>
      number of eigenvalues/eigenvectors.
    • getEigenvalue

      public Complex_F64 getEigenvalue​(int index)
      Description copied from interface: EigenDecomposition_F64

      Returns an eigenvalue as a complex number. For symmetric matrices the returned eigenvalue will always be a real number, which means the imaginary component will be equal to zero.

      NOTE: The order of the eigenvalues is dependent upon the decomposition algorithm used. This means that they may or may not be ordered by magnitude. For example the QR algorithm will returns results that are partially ordered by magnitude, but this behavior should not be relied upon.

      Specified by:
      getEigenvalue in interface EigenDecomposition_F64<DMatrixRMaj>
      index - Index of the eigenvalue eigenvector pair.
      An eigenvalue.
    • getEigenVector

      public DMatrixRMaj getEigenVector​(int index)
      Description copied from interface: EigenDecomposition

      Used to retrieve real valued eigenvectors. If an eigenvector is associated with a complex eigenvalue then null is returned instead.

      Specified by:
      getEigenVector in interface EigenDecomposition<DMatrixRMaj>
      index - Index of the eigenvalue eigenvector pair.
      If the associated eigenvalue is real then an eigenvector is returned, null otherwise.
    • decompose

      public boolean decompose​(DMatrixRMaj orig)
      Decomposes the matrix using the QR algorithm. Care was taken to minimize unnecessary memory copying and cache skipping.
      Specified by:
      decompose in interface DecompositionInterface<DMatrixRMaj>
      orig - The matrix which is being decomposed. Not modified.
      true if it decomposed the matrix or false if an error was detected. This will not catch all errors.
    • inputModified

      public boolean inputModified()
      Description copied from interface: DecompositionInterface
      Is the input matrix to DecompositionInterface.decompose( is modified during the decomposition process.
      Specified by:
      inputModified in interface DecompositionInterface<DMatrixRMaj>
      true if the input matrix to decompose() is modified.