LuDecomposition Class |
Namespace: Accord.Math.Decompositions
The LuDecomposition type exposes the following members.
Name | Description | |
---|---|---|
LuDecomposition(Double) |
Constructs a new LU decomposition.
| |
LuDecomposition(Double, Boolean) |
Constructs a new LU decomposition.
| |
LuDecomposition(Double, Boolean, Boolean) |
Constructs a new LU decomposition.
|
Name | Description | |
---|---|---|
Determinant |
Returns the determinant of the matrix.
| |
LogDeterminant |
Returns the log-determinant of the matrix.
| |
LowerTriangularFactor |
Returns the lower triangular factor L with A=LU.
| |
Nonsingular |
Returns if the matrix is non-singular (i.e. invertible).
Please see remarks for important information regarding
numerical stability when using this method.
| |
PivotPermutationVector |
Returns the pivot permutation vector.
| |
UpperTriangularFactor |
Returns the lower triangular factor L with A=LU.
|
Name | Description | |
---|---|---|
Clone |
Creates a new object that is a copy of the current instance.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
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 Solve(Double)
methods.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Inverse |
Solves a set of equation systems of type A * X = I.
| |
Reverse |
Reverses the decomposition, reconstructing the original matrix X.
| |
Solve(Double) |
Solves a set of equation systems of type A * X = B.
| |
Solve(Double) |
Solves a set of equation systems of type A * X = B.
| |
SolveTranspose |
Solves a set of equation systems of type X * A = B.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv) = L*U. If m < n, then L is m-by-m and U is m-by-n.
The LU decomposition with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if Nonsingular returns .
If you need to compute a LU decomposition for matrices with data types other than double, see LuDecompositionF, LuDecompositionD. If you need to compute a LU decomposition for a jagged matrix, see JaggedLuDecomposition, JaggedLuDecompositionF, and JaggedLuDecompositionD.
// Let's say we would like to compute the // LU decomposition of the following matrix: double[,] matrix = { { 2, -1, 0 }, { -1, 2, -1 }, { 0, -1, 2 } }; // Compute the LU decomposition with: var lu = new LuDecomposition(matrix); // Retrieve the lower triangular factor L: double[,] L = lu.LowerTriangularFactor; // Should be equal to double[,] expectedL = { { 1.0000, 0, 0 }, { -0.5000, 1.0000, 0 }, { 0, -0.6667, 1.0000 }, }; // Retrieve the upper triangular factor U: double[,] U = lu.UpperTriangularFactor; // Should be equal to double[,] expectedU = { { 2.0000, -1.0000, 0 }, { 0, 1.5000, -1.0000 }, { 0, 0, 1.3333 }, }; // Certify that the decomposition has worked as expected by // trying to reconstruct the original matrix with R = L * U: double[,] reconstruction = L.Dot(U); // reconstruction should be equal to // { // { 2, -1, 0 }, // { -1, 2, -1 }, // { 0, -1, 2 } // };