Class RealQR
java.lang.Object
org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition<Matrix,double[]>
org.flag4j.linalg.decompositions.unitary.RealUnitaryDecomposition
org.flag4j.linalg.decompositions.qr.RealQR
- All Implemented Interfaces:
Decomposition<Matrix>
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 Summary
Modifier and TypeFieldDescriptionprotected final boolean
Flag indicating if the reduced (true) or full (false)QR
decomposition should be computed.Fields inherited from class org.flag4j.linalg.decompositions.unitary.RealUnitaryDecomposition
currentFactor, norm, shift
Fields inherited from class org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition
applyUpdate, householderVector, minAxisSize, numCols, numRows, qFactors, storeReflectors, subDiagonal, transformData, transformMatrix, workArray
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionComputes theQR
decomposition of a real dense matrix.getR()
Gets the upper triangular matrixR
from theQR
decomposition.getUpper()
Gets the upper triangular matrixR
from the last decomposition.protected Matrix
initQ()
Creates and initializes Q to the appropriately sized identity matrix.Methods inherited from class org.flag4j.linalg.decompositions.unitary.RealUnitaryDecomposition
computeHouseholder, computePhasedNorm, findMaxAndInit, getQ, getUpper, initWorkArrays, updateData
Methods inherited from class org.flag4j.linalg.decompositions.unitary.UnitaryDecomposition
decomposeBase, setUp
-
Field Details
-
reduced
protected final boolean reducedFlag indicating if the reduced (true) or full (false)QR
decomposition should be computed.
-
-
Constructor Details
-
RealQR
public RealQR()Creates aQR
decomposer. This decomposer will compute the reducedQR
decomposition.- See Also:
-
RealQR
public RealQR(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
-
initQ
Creates and initializes Q to the appropriately sized identity matrix.- Specified by:
initQ
in classUnitaryDecomposition<Matrix,
double[]> - Returns:
- An identity matrix with the appropriate size.
-
getUpper
Gets the upper triangular matrixR
from the last decomposition. Same asgetR()
.- Specified by:
getUpper
in classUnitaryDecomposition<Matrix,
double[]> - Returns:
- The upper triangular matrix from the last decomposition.
-
getR
Gets the upper triangular matrixR
from theQR
decomposition.- Returns:
- The upper triangular matrix
R
from theQR
decomposition.
-