Class QR.QRMatrix
- java.lang.Object
-
- org.ujmp.core.doublematrix.calculation.general.decomposition.QR.QRMatrix
-
-
Field Summary
Fields Modifier and Type Field Description private int
m
Row and column dimensions.private int
n
Row and column dimensions.private double[][]
QR
Array for internal storage of decomposition.private double[]
Rdiag
Array for internal storage of diagonal of R.static long
serialVersionUID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DenseDoubleMatrix2D
getH()
Return the Householder vectorsDenseDoubleMatrix2D
getQ()
Generate and return the (economy-sized) orthogonal factorDenseDoubleMatrix2D
getR()
Return the upper triangular factorboolean
isFullRank()
Is the matrix full rank?Matrix
solve(Matrix B)
Least squares solution of A*X = B
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
QR
private final double[][] QR
Array for internal storage of decomposition.
-
m
private final int m
Row and column dimensions.
-
n
private final int n
Row and column dimensions.
-
Rdiag
private final double[] Rdiag
Array for internal storage of diagonal of R.
-
-
Constructor Detail
-
QRMatrix
public QRMatrix(Matrix A)
QR Decomposition, computed by Householder reflections.- Parameters:
A
- Rectangular matrix
-
-
Method Detail
-
isFullRank
public final boolean isFullRank()
Is the matrix full rank?- Returns:
- true if R, and hence A, has full rank.
-
getH
public final DenseDoubleMatrix2D getH()
Return the Householder vectors- Returns:
- Lower trapezoidal matrix whose columns define the reflections
-
getR
public final DenseDoubleMatrix2D getR()
Return the upper triangular factor- Returns:
- R
-
getQ
public final DenseDoubleMatrix2D getQ()
Generate and return the (economy-sized) orthogonal factor- Returns:
- Q
-
solve
public final Matrix solve(Matrix B)
Least squares solution of A*X = B- Parameters:
B
- A Matrix with as many rows as A and any number of columns.- Returns:
- X that minimizes the two norm of Q*R*X-B.
- Throws:
java.lang.IllegalArgumentException
- Matrix row dimensions must agree.java.lang.RuntimeException
- Matrix is rank deficient.
-
-