Class HermHess
Computes the Hessenberg decomposition of a real dense Hermitian matrix.
The Hessenberg decomposition decomposes a given Hermitian matrix \( A \) into the product: \[ A = QHQ^{H} \] where \( Q \) is an orthogonal matrix and \( H \) is a Hermitian tri-diagonal matrix (special case of Hessenburg form) which is similar to \( A \) (i.e. has the same eigenvalues)
A matrix \( H \) is in tri-diagonal form if it has all zeros below the first sub-diagonal and above the first super-diagonal.
For example, the following matrix is in symmetric tri-diagonal form where each '\( \times \)' may hold a different value (provided the matrix is symmetric): \[ \begin{bmatrix} \times & \times & 0 & 0 & 0 \\ \times & \times & \times & 0 & 0 \\ 0 & \times & \times & \times & 0 \\ 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.
Usage:
The decomposition workflow typically follows these steps:- Instantiate an instance of
HermHess
. - Call
decompose(CMatrix)
to perform the factorization. - Retrieve the resulting matrices using
getH()
andComplexUnitaryDecomposition.getQ()
.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag indicating if an explicit check should be made that the matrix to be decomposed is Hermitian.Fields inherited from class org.flag4j.linalg.decompositions.unitary.ComplexUnitaryDecomposition
currentFactor, norm, normRe
Fields inherited from class org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition
applyUpdate, householderVector, iHigh, iLow, inPlace, minAxisSize, numCols, numRows, qFactors, storeReflectors, subDiagonal, transformData, transformMatrix, workArray
Fields inherited from class org.flag4j.linalg.decompositions.Decomposition
hasDecomposed
-
Constructor Summary
ConstructorsConstructorDescriptionHermHess()
Constructs a Hessenberg decomposer for Hermitian matrices.HermHess
(boolean computeQ) Constructs a Hessenberg decomposer for Hermitian matrices.HermHess
(boolean computeQ, boolean enforceHermitian) Constructs a Hessenberg decomposer for Hermitian matrices.HermHess
(boolean computeQ, boolean enforceHermitian, boolean inPlace) Constructs a Hessenberg decomposer for Hermitian matrices. -
Method Summary
Modifier and TypeMethodDescriptionApplies decomposition to the source matrix.protected double
findMaxAndInit
(int j) Finds the maximum value inUnitaryDecomposition.transformMatrix
at columnj
at or below thej
th row.getH()
Gets the Hessenberg matrix, \( H \), from the decomposition.protected void
Performs basic setup for the decomposition.protected void
updateData
(int j) Updates theUnitaryDecomposition.transformMatrix
matrix using the computed Householder vector fromComplexUnitaryDecomposition.computeHouseholder(int)
.Methods inherited from class org.flag4j.linalg.decompositions.hess.ComplexHess
decompose, getUpper, initQ
Methods inherited from class org.flag4j.linalg.decompositions.unitary.ComplexUnitaryDecomposition
computeHouseholder, computePhasedNorm, getQ, getUpper, initWorkArrays
Methods inherited from class org.flag4j.linalg.decompositions.Decomposition
ensureHasDecomposed
-
Field Details
-
enforceHermitian
protected boolean enforceHermitianFlag indicating if an explicit check should be made that the matrix to be decomposed is Hermitian.
-
-
Constructor Details
-
HermHess
public HermHess()Constructs a Hessenberg decomposer for Hermitian matrices. By default, the Householder vectors used in the decomposition will be stored so that the full unitary \( Q \) matrix can be formed by callingComplexUnitaryDecomposition.getQ()
. -
HermHess
public HermHess(boolean computeQ) Constructs a Hessenberg decomposer for Hermitian matrices.- Parameters:
computeQ
- Flag indicating if the unitary \( Q \) matrix from the Hessenberg decomposition should be explicitly computed. iftrue
, then the \( Q \) matrix will be computed explicitly.
-
HermHess
public HermHess(boolean computeQ, boolean enforceHermitian) Constructs a Hessenberg decomposer for Hermitian matrices.- Parameters:
computeQ
- Flag indicating if the unitary \( Q \) matrix from the Hessenberg decomposition should be explicitly computed. iftrue
, then the \( Q \) matrix will be computed explicitly.enforceHermitian
- Flag indicating if an explicit check should be made to ensure any matrix passed todecompose(CMatrix)
is truly Hermitian. iftrue
, an exception will be thrown if the matrix is not Hermitian. If false, the decomposition will proceed under the assumption that the matrix is Hermitian whether it actually is or not. If the matrix is not Hermitian, then the values in the upper triangular portion of the matrix are taken to be the values.
-
HermHess
public HermHess(boolean computeQ, boolean enforceHermitian, boolean inPlace) Constructs a Hessenberg decomposer for Hermitian matrices.- Parameters:
computeQ
- Flag indicating if the unitary \( Q \) matrix from the Hessenberg decomposition should be explicitly computed. iftrue
, then the \( Q \) matrix will be computed explicitly.enforceHermitian
- Flag indicating if an explicit check should be made to ensure any matrix passed todecompose(CMatrix)
is truly Hermitian. iftrue
, an exception will be thrown if the matrix is not Hermitian. If false, the decomposition will proceed under the assumption that the matrix is Hermitian whether it actually is or not. If the matrix is not Hermitian, then the values in the upper triangular portion of the matrix are taken to be the values.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.
- If
-
-
Method Details
-
decompose
Applies decomposition to the source matrix.- Overrides:
decompose
in classComplexHess
- Parameters:
src
- The source matrix to decompose. (Assumed to be a Hermitian matrix).- Returns:
- A reference to this decomposer.
-
getH
Gets the Hessenberg matrix, \( H \), from the decomposition. The matrix will be Hermitian tri-diagonal.- Overrides:
getH
in classComplexHess
- Returns:
- The Hermitian tri-diagonal (Hessenberg) matrix, \( H \), from this decomposition.
-
findMaxAndInit
protected double findMaxAndInit(int j) Finds the maximum value inUnitaryDecomposition.transformMatrix
at columnj
at or below thej
th row. This method also initializes the firstnumRows-j
data of the storage arrayUnitaryDecomposition.householderVector
to the data of this column.- Overrides:
findMaxAndInit
in classComplexUnitaryDecomposition
- Parameters:
j
- Index of column (and starting row) to compute max of.- Returns:
- The maximum value in
UnitaryDecomposition.transformMatrix
at columnj
at or below thej
th row.
-
setUp
Performs basic setup for the decomposition.- Overrides:
setUp
in classUnitaryDecomposition<CMatrix,
Complex128[]> - Parameters:
src
- The matrix to be decomposed.- Throws:
LinearAlgebraException
- If the matrix is not Hermitian andenforceHermitian
is true or if the matrix is not square regardless of the value ofenforceHermitian
.
-
updateData
protected void updateData(int j) Updates theUnitaryDecomposition.transformMatrix
matrix using the computed Householder vector fromComplexUnitaryDecomposition.computeHouseholder(int)
.- Overrides:
updateData
in classComplexUnitaryDecomposition
- Parameters:
j
- Index of sub-matrix for which the Householder reflector was computed for.
-