Class ComplexQR
java.lang.Object
org.flag4j.linalg.decompositions.Decomposition<CMatrix>
org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition<CMatrix,Complex128[]>
org.flag4j.linalg.decompositions.unitary.ComplexUnitaryDecomposition
org.flag4j.linalg.decompositions.qr.ComplexQR
Computes the QR decomposition of dense complex matrix.
The QR decomposition factorizes a given matrix \( A \) into the product of an orthogonal matrix \( Q \) and an upper triangular matrix \( R \), such that: \[ A = QR \]
The decomposition can be computed in either the full or reduced form:
- Reduced QR decomposition: When
reduced = true
, the decomposition produces a compact form where \( Q \) has the same number of rows as \( A \) but only as many columns as the rank of \( A \). - Full QR decomposition: When
reduced = false
, the decomposition produces a square orthogonal matrix \( Q \) with the same number of rows as \( A \).
Usage:
The decomposition workflow typically follows these steps:- Instantiate an instance of
ComplexQR
. - Call
decompose(CMatrix)
to perform the factorization. - Retrieve the resulting matrices using
ComplexUnitaryDecomposition.getQ()
andgetR()
.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
Flag indicating if the reduced or full decomposition should be computed.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes theQR
decomposition of a real dense matrix.getR()
Gets the upper triangular matrix, \( R \), from the QR decomposition.getUpper()
Gets the upper triangular matrix, \( R \), from the last decomposition.protected CMatrix
initQ()
Creates and initializes \( Q \) to the appropriately sized identity matrix.Methods inherited from class org.flag4j.linalg.decompositions.unitary.ComplexUnitaryDecomposition
computeHouseholder, computePhasedNorm, findMaxAndInit, getQ, getUpper, initWorkArrays, updateData
Methods inherited from class org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition
decompose, setUp
Methods inherited from class org.flag4j.linalg.decompositions.Decomposition
ensureHasDecomposed
-
Field Details
-
reduced
protected final boolean reducedFlag indicating if the reduced or full decomposition should be computed.- If
true
: the reduced decomposition will be computed. - If
false
: the full decomposition will be computed.
- If
-
-
Constructor Details
-
ComplexQR
public ComplexQR()Creates aQR
decomposer. This decomposer will compute the reducedQR
decomposition.- See Also:
-
ComplexQR
public ComplexQR(boolean reduced) Creates aQR
decomposer to compute either the full or reducedQR
decomposition.- Parameters:
reduced
- Flag indicating if this decomposer should compute the full or reducedQR
decomposition.
-
-
Method Details
-
decompose
Computes theQR
decomposition of a real dense matrix.- Overrides:
decompose
in classUnitaryDecomposition<CMatrix,
Complex128[]> - Parameters:
src
- The source matrix to decompose.- Returns:
- A reference to this decomposer.
-
initQ
Creates and initializes \( Q \) to the appropriately sized identity matrix.- Specified by:
initQ
in classUnitaryDecomposition<CMatrix,
Complex128[]> - Returns:
- An identity matrix with the appropriate size.
-
getUpper
Gets the upper triangular matrix, \( R \), from the last decomposition.- Specified by:
getUpper
in classUnitaryDecomposition<CMatrix,
Complex128[]> - Returns:
- The upper triangular matrix, \( R \), from the last decomposition.
-
getR
Gets the upper triangular matrix, \( R \), from the QR decomposition.- Returns:
- The upper triangular matrix, \( R \), from the QR decomposition.
-