void Diag(TVec Vec, Int32 kk)
Copies the kk-th diagonal of TSparseMtx to the Vec object.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Vec | TVec | source TVec |
| 2 | kk | Int32 |
Result: stored in self (calling object)
Remarks:
Copies the kk-th diagonal of TSparseMtx to the Vec object. If k = 0 then the main diagonal matrix is obtained, if k < 0 then the k-th subdiagonal matrix is obtained and if k > 0 the then the k-th super diagonal is copied to Vec. The Vec parameters size is set automatically.
Examples
using Dew.Math;
using Dew.Math.Units;
namespace Dew.Examples
{
private 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);
}
}