TSparseMtx LowerTriangle(TSparseMtx Src, Boolean Diagonal)
Extract lower part of the Mtx.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TSparseMtx | |
| 2 | Diagonal | Boolean |
Returns: TSparseMtx
Remarks:
Copies only the lower triangular part of the Src sparse matrix. The result is stored in the calling sparse matrix. If the Diagonal boolean parameter is true then the Src matrix main diagonal elements will be copied to the calling matrix main diagonal elements. If the Diagonal parameter is false, the calling matrix main diagonal elements will be set to zero.
Examples
using Dew.Math;
using Dew.Math._Units;
void Example()
{
Vector d = new Vector(0);
TSparseMtx asp = new TSparseMtx();
TSparseMtx bsp = new TSparseMtx();
TSparseMtx csp = new TSparseMtx();
TSparseMtx dsp = new TSparseMtx();
// ...
// #1 : split asp into lower(bsp), upper(csp) and diagonal(d) sections
bsp.LowerTriangle(asp);
csp.UpperTriangle(asp);
asp.Diag(d);
// now combine lower(bsp), upper, and diagonal(d) back
dsp.AddSplit(bsp,d,csp);
// should be equal
if (!asp.Equal(dsp)()) Console.WriteLine("Not equal!");
}
See Also: TSparseMtx.UpperTriangle