﻿ JaggedLuDecomposition Class   # JaggedLuDecomposition Class

LU decomposition of a jagged rectangular matrix. Inheritance Hierarchy
SystemObject
Accord.Math.DecompositionsJaggedLuDecomposition

Namespace:  Accord.Math.Decompositions
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0 Syntax
```public sealed class JaggedLuDecomposition : ICloneable,
ISolverArrayDecomposition<double>```

The JaggedLuDecomposition type exposes the following members. Constructors
NameDescription JaggedLuDecomposition
Constructs a new LU decomposition.
Top Properties
NameDescription 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). PivotPermutationVector
Returns the pivot permutation vector. UpperTriangularFactor
Returns the lower triangular factor L with A=LU.
Top Methods
NameDescription 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. SolveForDiagonal
Solves a set of equation systems of type A * X = B where B is a diagonal matrix. SolveTranspose
Solves a set of equation systems of type X * A = B. ToString
Returns a string that represents the current object.
(Inherited from Object.)
Top Extension Methods
NameDescription 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.) ToTOverloaded.
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.)
Top Remarks

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 JaggedLuDecompositionF, JaggedLuDecompositionD. If you need to compute a LU decomposition for a multidimensional matrix, see LuDecomposition, LuDecompositionF, and LuDecompositionD. Examples
```// Let's say we would like to compute the
// LU decomposition of the following matrix:
double[][] matrix =
{
new double[] {  2, -1,  0 },
new double[] { -1,  2, -1 },
new double[] {  0, -1,  2 }
};

// Compute the LU decomposition with:
var lu = new JaggedLuDecomposition(matrix);

// Retrieve the lower triangular factor L:
double[][] L = lu.LowerTriangularFactor;

// Should be equal to
double[][] expectedL =
{
new double[] {  1.0000,         0,         0 },
new double[] { -0.5000,    1.0000,         0 },
new double[] {       0,   -0.6667,    1.0000 },
};

// Retrieve the upper triangular factor U:
double[][] U = lu.UpperTriangularFactor;

// Should be equal to
double[][] expectedU =
{
new double[] { 2.0000,   -1.0000,         0 },
new double[] {      0,    1.5000,   -1.0000 },
new double[] {      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 }
// };``` See Also