Summary
Extract upper part of the Mtx.
Class
TSparseMtx
Declaration
Function UpperTriangle(Mtx: TSparseMtx; Diagonal: boolean = false): TSparseMtx;
Description
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.
Example 1
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;
| Copyright 2008 Dew Research |
http://www.dewresearch.com