You are here: Symbol Reference > Sparse Namespace > Classes > TSparseMtx Class > public > TSparseMtx.UpperTriangle Method
MtxVec VCL
ContentsIndex
PreviousUpNext
TSparseMtx.UpperTriangle Method

Extract upper part of the Mtx.

Pascal
function UpperTriangle(const Src: TSparseMtx; Diagonal: boolean = false): TSparseMtx; overload;

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.

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;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!