Vector.Diag Method

TVec Diag(TMtx Mtx, Int32 k)

Copies the k-th diagonal from the TMtx object.

#NameTypeDescription
1MtxTMtxsource TMtx
2kInt32

Result: stored in self (calling object), returns self for chaining

Remarks:

Copies the k-th diagonal from the TMtx object. If k = 0 then the main diagonal is copied, if k < 0 then the subdiagonal is copied and if k > 0 then the k-th super diagonal is copied to the calling vector.

Examples
Vector a;
Matrix d;
// setup matrix
d.SetIt(2,2,false,[1,-2,
3, 4]);
// get main diagonal from matrix
a.Diag(d,0); // a now containes new double[] {1,4};
See Also: Vector.Diag