function Diag(const Mtx: TMtx; k: Integer): Vector;
Returns k-th diagonal from the source matrix.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx | TMtx | |
| 2 | k | Integer |
Returns: Vector
Remarks:
Internally calls Vector.Diag
Examples
var a: TVec;
d: TMtx;
begin
CreateIt(a);
CreateIt(d);
try
// setup matrix
d.SetIt(2,2,False,[1,-2,
3, 4]);
// get main diagonal from matrix
a.Diag(d,0); // a now containes [1,4];
finally
FreeIt(a);
FreeIt(d);
end;
end;