TSparseMtx.UpperTriangle Method

function UpperTriangle(const Src: TSparseMtx; Diagonal: Boolean): TSparseMtx;

Extract upper part of the Mtx.

#NameTypeDescription
1SrcTSparseMtx
2DiagonalBoolean

Returns: TSparseMtx

Remarks:

Copies only the upper triangular part of the Mtx sparse matrix. The result is stored in the calling sparse matrix. If the Diagonal boolean parameter is true then the Mtx 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
var asp, bsp: TSparseMtx;
    csp, dsp: TSparseMtx;
    d: Vector;
begin
    // ...
    // #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 not asp.Equal(dsp) then Eraise('Not Equal!');
end;
See Also: TSparseMtx.LowerTriangle