cern.colt.matrix.tfloat.algo.decomposition
Class DenseFloatQRDecomposition
- java.lang.Object
-
- cern.colt.matrix.tfloat.algo.decomposition.DenseFloatQRDecomposition
-
- All Implemented Interfaces:
- java.io.Serializable
public class DenseFloatQRDecomposition extends java.lang.Object implements java.io.SerializableFor an m x n matrix A with m >= n, the QR decomposition is an m x n orthogonal matrix Q and an n x n upper triangular matrix R so that A = Q*R.The QR decompostion always exists, even if the matrix does not have full rank, so the constructor will never fail. The primary use of the QR decomposition is in the least squares solution of nonsquare systems of simultaneous linear equations. This will fail if isFullRank() returns false.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DenseFloatQRDecomposition(FloatMatrix2D A)Constructs and returns a new QR decomposition object; computed by Householder reflections; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description FloatMatrix2DgetH()Returns the Householder vectors H.FloatMatrix2DgetQ()Generates and returns the (economy-sized) orthogonal factor Q.FloatMatrix2DgetR()Returns the upper triangular factor, R.booleanhasFullRank()Returns whether the matrix A has full rank.FloatMatrix1Dsolve(FloatMatrix1D b)Least squares solution of A*x = b; returns x.FloatMatrix2Dsolve(FloatMatrix2D B)Least squares solution of A*X = B; returns X.java.lang.StringtoString()Returns a String with (propertyName, propertyValue) pairs.
-
-
-
Constructor Detail
-
DenseFloatQRDecomposition
public DenseFloatQRDecomposition(FloatMatrix2D A)
Constructs and returns a new QR decomposition object; computed by Householder reflections; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.- Parameters:
A- A rectangular matrix.- Throws:
java.lang.IllegalArgumentException- if A.rows() < A.columns().
-
-
Method Detail
-
getH
public FloatMatrix2D getH()
Returns the Householder vectors H.- Returns:
- A lower trapezoidal matrix whose columns define the householder reflections.
-
getQ
public FloatMatrix2D getQ()
Generates and returns the (economy-sized) orthogonal factor Q.- Returns:
- Q
-
getR
public FloatMatrix2D getR()
Returns the upper triangular factor, R.- Returns:
- R
-
hasFullRank
public boolean hasFullRank()
Returns whether the matrix A has full rank.- Returns:
- true if R, and hence A, has full rank.
-
solve
public FloatMatrix1D solve(FloatMatrix1D b)
Least squares solution of A*x = b; returns x.- Parameters:
b- right-hand side.- Returns:
- x that minimizes the two norm of Q*R*x - b.
- Throws:
java.lang.IllegalArgumentException- if b.size() != A.rows().java.lang.IllegalArgumentException- if !this.hasFullRank() (A is rank deficient).
-
solve
public FloatMatrix2D solve(FloatMatrix2D B)
Least squares solution of A*X = B; returns X.- 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- if B.rows() != A.rows().java.lang.IllegalArgumentException- if !this.hasFullRank() (A is rank deficient).
-
toString
public java.lang.String toString()
Returns a String with (propertyName, propertyValue) pairs. Useful for debugging or to quickly get the rough picture. For example,rank : 3 trace : 0
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG