Click or drag to resize
Accord.NET (logo)

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>
Request Example View Source

The JaggedLuDecomposition type exposes the following members.

Constructors
  NameDescription
Public methodJaggedLuDecomposition
Constructs a new LU decomposition.
Top
Properties
  NameDescription
Public propertyDeterminant
Returns the determinant of the matrix.
Public propertyLogDeterminant
Returns the log-determinant of the matrix.
Public propertyLowerTriangularFactor
Returns the lower triangular factor L with A=LU.
Public propertyNonsingular
Returns if the matrix is non-singular (i.e. invertible).
Public propertyPivotPermutationVector
Returns the pivot permutation vector.
Public propertyUpperTriangularFactor
Returns the lower triangular factor L with A=LU.
Top
Methods
  NameDescription
Public methodClone
Creates a new object that is a copy of the current instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetInformationMatrix
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.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInverse
Solves a set of equation systems of type A * X = I.
Public methodReverse
Reverses the decomposition, reconstructing the original matrix X.
Public methodSolve(Double)
Solves a set of equation systems of type A * X = B.
Public methodSolve(Double)
Solves a set of equation systems of type A * X = B.
Public methodSolveForDiagonal
Solves a set of equation systems of type A * X = B where B is a diagonal matrix.
Public methodSolveTranspose
Solves a set of equation systems of type X * A = B.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(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.)
Public Extension MethodToTOverloaded.
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