Class LowerTriangularMatrix
Class for lower triangular matrices
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Math
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
[DataContract]
public class LowerTriangularMatrix : Matrix, IList<double>, ICollection<double>, IReadOnlyList<double>, IReadOnlyCollection<double>, IEnumerable<double>, IEnumerable, ICloneable, SettableTo<Matrix>, CanSetAllElementsTo<double>
Constructors
LowerTriangularMatrix()
Default constructor just used for serialization.
Declaration
protected LowerTriangularMatrix()
LowerTriangularMatrix(Double[,])
Constructs a matrix from data in a 2D array.
Declaration
public LowerTriangularMatrix(double[, ] data)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | data | 2D array of elements. |
Remarks
The 2D array is copied into new storage. The size of the matrix is taken from the array.
LowerTriangularMatrix(Int32, Int32)
Constructs a zero matrix of the given dimensions.
Declaration
public LowerTriangularMatrix(int nRows, int nCols)
Parameters
Type | Name | Description |
---|---|---|
Int32 | nRows | Number of rows >= 0. |
Int32 | nCols | Number of columns >= 0. |
LowerTriangularMatrix(Int32, Int32, Double[])
Constructs a matrix by referencing an array.
Declaration
public LowerTriangularMatrix(int nRows, int nCols, double[] data)
Parameters
Type | Name | Description |
---|---|---|
Int32 | nRows | Number of rows. |
Int32 | nCols | Number of columns. |
Double[] | data | Storage for the matrix elements. |
Methods
CheckLowerTriangular()
Checks that this instance is lower triangular
Declaration
[Conditional("DEBUG")]
public void CheckLowerTriangular()
Clone()
Creates a full clone of this instance (including the data)
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
Object |
Overrides
Determinant()
Returns the determinant of this lower-triangular matrix.
Declaration
public double Determinant()
Returns
Type | Description |
---|---|
Double | The determinant of this. |
Inverse()
Returns the inverse of this lower triangular matrix
Declaration
public LowerTriangularMatrix Inverse()
Returns
Type | Description |
---|---|
LowerTriangularMatrix |
LogDeterminant(Boolean)
Returns the natural logarithm of the determinant of a lower-triangular matrix.
Declaration
public double LogDeterminant(bool ignoreInfinity = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ignoreInfinity | If true, +infinity on the diagonal is treated as 1. |
Returns
Type | Description |
---|---|
Double | The log-determinant of this. |
ProdDiag()
Returns the product of diagonal elements of this lower triangular matrix
Declaration
public double ProdDiag()
Returns
Type | Description |
---|---|
Double |
|
SetToCholesky(Matrix)
Gets the Cholesky decomposition L, such that L*L' = A.
Declaration
public bool SetToCholesky(Matrix A)
Parameters
Type | Name | Description |
---|---|---|
Matrix | A | A symmetric matrix to decompose. |
Returns
Type | Description |
---|---|
Boolean | True if |
Remarks
The decomposition is a lower triangular matrix L, returned in this
.
A
must be symmetric, but need not be positive definite.
If A
is positive semidefinite,
then L will satisfy LL' = A.
Otherwise, L will only approximately satisfy LL' = A.
SetToInverse(LowerTriangularMatrix)
Modifies this
to be the inverse of A.
Declaration
public void SetToInverse(LowerTriangularMatrix A)
Parameters
Type | Name | Description |
---|---|---|
LowerTriangularMatrix | A | Can be the same object as |
TraceLn(Boolean)
Returns the sum of the logarithm of diagonal elements.
Declaration
public double TraceLn(bool ignoreInfinity = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | ignoreInfinity | If true, +infinity on the diagonal is treated as 1. |
Returns
Type | Description |
---|---|
Double |
|
Transpose()
Returns the transpose of this lower triangular matrix
Declaration
public UpperTriangularMatrix Transpose()
Returns
Type | Description |
---|---|
UpperTriangularMatrix |