Class RealQR

All Implemented Interfaces:
Decomposition<Matrix>

public class RealQR extends RealUnitaryDecomposition

Instances of this class compute the QR decomposition of a real dense matrix.

The QR decomposition, decomposes a matrix A into an orthogonal matrix Q and an upper triangular matrix R such that A=QR.

Much of this code has been adapted from the EJML library.

  • Field Details

    • reduced

      protected final boolean reduced
      Flag indicating if the reduced (true) or full (false) QR decomposition should be computed.
  • Constructor Details

    • RealQR

      public RealQR()
      Creates a QR decomposer. This decomposer will compute the reduced QR decomposition.
      See Also:
    • RealQR

      public RealQR(boolean reduced)
      Creates a QR decomposer to compute either the full or reduced QR decomposition.
      Parameters:
      reduced - Flag indicating if this decomposer should compute the full or reduced QR decomposition.
  • Method Details

    • decompose

      public RealQR decompose(Matrix src)
      Computes the QR decomposition of a real dense matrix.
      Parameters:
      src - The source matrix to decompose.
      Returns:
      A reference to this decomposer.
    • initQ

      protected Matrix initQ()
      Creates and initializes Q to the appropriately sized identity matrix.
      Specified by:
      initQ in class UnitaryDecomposition<Matrix,double[]>
      Returns:
      An identity matrix with the appropriate size.
    • getUpper

      public Matrix getUpper()
      Gets the upper triangular matrix R from the last decomposition. Same as getR().
      Specified by:
      getUpper in class UnitaryDecomposition<Matrix,double[]>
      Returns:
      The upper triangular matrix from the last decomposition.
    • getR

      public Matrix getR()
      Gets the upper triangular matrix R from the QR decomposition.
      Returns:
      The upper triangular matrix R from the QR decomposition.