Class QrDecomposition
QR decomposition for a rectangular matrix.
Inheritance
Implements
Namespace: ISynergy.Framework.Mathematics.Decompositions
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public sealed class QrDecomposition : ICloneable, ISolverMatrixDecomposition<double>
Remarks
For an m-by-n matrix A
with m >= n
, the QR decomposition
is an m-by-n orthogonal matrix Q
and an n-by-n upper triangular
matrix R
so that A = Q * R
.
The QR decomposition 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 FullRank returns false.
Constructors
View SourceQrDecomposition(Double[,], Boolean, Boolean, Boolean)
Constructs a QR decomposition.
Declaration
public QrDecomposition(double[, ] value, bool transpose = false, bool economy = true, bool inPlace = false)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | value | The matrix A to be decomposed. |
System.Boolean | transpose | True if the decomposition should be performed on the transpose of A rather than A itself, false otherwise. Default is false. |
System.Boolean | economy | True to perform the economy decomposition, where only .the information needed to solve linear systems is computed. If set to false, the full QR decomposition will be computed. |
System.Boolean | inPlace | True if the decomposition should be done in place,
overriding the given matrix |
Properties
View SourceDiagonal
Returns the diagonal of R
.
Declaration
public double[] Diagonal { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
FullRank
Shows if the matrix A
is of full rank.
Declaration
public bool FullRank { get; }
Property Value
Type | Description |
---|---|
System.Boolean | The value is true if |
OrthogonalFactor
Returns the (economy-size) orthogonal factor Q
.
Declaration
public double[, ] OrthogonalFactor { get; }
Property Value
Type | Description |
---|---|
System.Double[,] |
UpperTriangularFactor
Returns the upper triangular factor R
.
Declaration
public double[, ] UpperTriangularFactor { get; }
Property Value
Type | Description |
---|---|
System.Double[,] |
Methods
View SourceClone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
GetInformationMatrix()
Computes (Xt * X)^1
(the inverse of the covariance matrix). This
matrix can be used to determine standard errors for the coefficients when
solving a linear set of equations through any of the
Declaration
public double[, ] GetInformationMatrix()
Returns
Type | Description |
---|---|
System.Double[,] |
Inverse()
Least squares solution of A * X = I
Declaration
public double[, ] Inverse()
Returns
Type | Description |
---|---|
System.Double[,] |
Reverse()
Reverses the decomposition, reconstructing the original matrix X
.
Declaration
public double[, ] Reverse()
Returns
Type | Description |
---|---|
System.Double[,] |
Solve(Double[])
Least squares solution of A * X = B
Declaration
public double[] Solve(double[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | value | Right-hand-side matrix with as many rows as |
Returns
Type | Description |
---|---|
System.Double[] | A matrix that minimized the two norm of |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Matrix row dimensions must be the same. |
System.InvalidOperationException | Matrix is rank deficient. |
Solve(Double[,])
Least squares solution of A * X = B
Declaration
public double[, ] Solve(double[, ] value)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | value | Right-hand-side matrix with as many rows as |
Returns
Type | Description |
---|---|
System.Double[,] | A matrix that minimized the two norm of |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Matrix row dimensions must be the same. |
System.InvalidOperationException | Matrix is rank deficient. |
SolveTranspose(Double[,])
Least squares solution of X * A = B
Declaration
public double[, ] SolveTranspose(double[, ] value)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | value | Right-hand-side matrix with as many columns as |
Returns
Type | Description |
---|---|
System.Double[,] | A matrix that minimized the two norm of |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Matrix column dimensions must be the same. |
System.InvalidOperationException | Matrix is rank deficient. |