Class RealHess

Direct Known Subclasses:
SymmHess

public class RealHess extends RealUnitaryDecomposition

Computes the Hessenberg decomposition of a real dense square matrix.

The Hessenberg decomposition decomposes a given square matrix \( A \) into the product: \[ A = QHQ^{T} \] where \( Q \) is an orthogonal matrix and \( H \) is an upper Hessenberg matrix, which is similar to \( A \) (i.e., it has the same eigenvalues).

A matrix \( H \) is in upper Hessenburg form if it is nearly upper triangular. Specifically, if \( H \) has all zeros below the first sub-diagonal.

For example, the following matrix is in upper Hessenburg form where each '\( \times \)' may hold a different value: \[ \begin{bmatrix} \times & \times & \times & \times & \times \\ \times & \times & \times & \times & \times \\ 0 & \times & \times & \times & \times \\ 0 & 0 & \times & \times & \times \\ 0 & 0 & 0 & \times & \times \end{bmatrix} \]

Efficiency Considerations:

  • If the orthogonal matrix \( Q \) is not required, setting computeQ = false in the constructor may improve performance.
  • Support for in-place decomposition to reduce memory usage.
  • Support for decomposition of matrix sub-blocks, enabling efficient eigenvalue computations.

Usage:

The decomposition workflow typically follows these steps:
  1. Instantiate an instance of RealHess.
  2. Call decompose(Matrix) to perform the factorization.
  3. Retrieve the resulting matrices using getH() and RealUnitaryDecomposition.getQ().
See Also:
  • Constructor Details

    • RealHess

      public RealHess()

      Creates a real Hessenburg decomposer which will reduce the matrix to an upper quasi-triangular matrix which is has zeros below the first sub-diagonal. That is, reduce to an upper Hessenburg matrix.

      By default, the orthogonal matrix will be computed. To specify if the orthogonal matrix should be computed, use RealHess(boolean).

      See Also:
    • RealHess

      public RealHess(boolean computeQ)

      Creates a real Hessenburg decomposer which will reduce the matrix to an upper quasi-triangular matrix which is has zeros below the first sub-diagonal. That is, reduce to an upper Hessenburg matrix.

      Parameters:
      computeQ - Flag indicating if the orthogonal matrix in the Hessenburg decomposition should be computed. If it is not needed, setting this to false may yield an increase in performance.
      See Also:
    • RealHess

      public RealHess(boolean computeQ, boolean inPlace)

      Creates a real Hessenburg decomposer which will reduce the matrix to an upper quasi-triangular matrix which is has zeros below the first sub-diagonal. That is, reduce to an upper Hessenburg matrix.

      Parameters:
      computeQ - Flag indicating if the orthogonal matrix in the Hessenburg decomposition should be computed. If it is not needed, setting this to false may yield an increase in performance.
      inPlace - Flag indicating if the decomposition should be done in-place.
      • If true, then the decomposition will be done in place.
      • If false, then the decomposition will be done out-of-place.
      See Also:
  • Method Details

    • decompose

      public RealHess decompose(Matrix src)

      Computes the Hessenberg decomposition of the specified matrix.

      Note, the computation of the orthogonal matrix \( Q \) in the decomposition is deferred until RealUnitaryDecomposition.getQ() is explicitly called. This allows for efficient decompositions when \( Q \) is not needed.

      Overrides:
      decompose in class UnitaryDecomposition<Matrix,double[]>
      Parameters:
      src - The source matrix to decompose.
      Returns:
      A reference to this decomposer.
      Throws:
      LinearAlgebraException - If src is not a square matrix.
    • decompose

      public RealHess decompose(Matrix src, int iLow, int iHigh)

      Applies decomposition to the source matrix. Note, the computation of the orthogonal matrix \( Q \) in the decomposition is deferred until RealUnitaryDecomposition.getQ() is explicitly called. This allows for efficient decompositions when \( Q \) is not needed.

      This method can be used specify that only a sub-block within the full matrix needs to be reduced. This is useful when you know that an upper and lower diagonal block of the matrix is already in the correct form, and you only need to reduce an inner sub-block of the full matrix. Most commonly this would be useful after balancing a matrix using RealBalancer, which results in the form \[ \begin{bmatrix} T_1 & X & Y \\ \mathbf{0} & B & Z \\ \mathbf{0} & \mathbf{0} & T_1 \end{bmatrix} \] where \( T_{1} \) and \( T_{2} \) are in upper-triangular form. As such, only the \( B \) block needs to be reduced. The staring row/column index of \( B \) is specified by iLow (inclusive) and the ending row/column index is specified by iHigh (exclusive). It should be noted that the blocks \( X \) and \( Z \) will also be updated during the reduction of \( B \) so the full matrix must still be passed.

      Overrides:
      decompose in class UnitaryDecomposition<Matrix,double[]>
      Parameters:
      src - The source matrix to decompose.
      iLow - Lower bound (inclusive) of the sub-matrix to reduce to upper Hessenburg form.
      iHigh - Upper bound (exclusive) of the sub-matrix to reduce to upper Hessenburg form.
      Returns:
      A reference to this decomposer.
      Throws:
      LinearAlgebraException - If src is not a square matrix.
    • 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 Hessenburg matrix, \( H \), from the last decomposition. Same as getH()
      Specified by:
      getUpper in class UnitaryDecomposition<Matrix,double[]>
      Returns:
      The upper Hessenburg matrix from the last decomposition.
    • getH

      public Matrix getH()
      Gets the upper Hessenburg matrix, \( H \), from the Hessenburg decomposition.
      Returns:
      The upper Hessenburg matrix, \( H \), from the Hessenburg decomposition.