VectorInt.Diag Method

function Diag(const Mtx: TMtxInt; k: Integer): TVecInt;

Copies the k-th diagonal from the TMtxInt object.

#NameTypeDescription
1MtxTMtxInt
2kInteger

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

Remarks:

Copies the k-th diagonal from the TMtxInt 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
var a: VectorInt;
    d: MatrixInt;
begin
    // setup matrix
    d := [[1,-2],[3,4]];
    // get main diagonal from matrix
    a.Diag(d,0); // a now containes [1,4];
end;
See Also: TMtx.Diag