TMtxInt UpperTriangle(TMtxInt Mtx, Boolean ZeroLower, Boolean Diagonal)
Constructs upper triangular matrix.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Mtx | TMtxInt | source TMtxInt |
| 2 | ZeroLower | Boolean | |
| 3 | Diagonal | Boolean |
Result: stored in self (calling object), returns self for chaining
Remarks:
The method uses Mtx matrix to construct an upper triangular matrix. The results are stored in the calling matrix. If the ZeroLower parameter is true then the calling matrix subdiagonal elements will be set to zero - otherwise the subdiagonal elements will not be initialized. 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
TMtxInt A;
TMtxInt B;
MtxVec.CreateIt(out A, out B);
A.SetIt(2,1,[1,2,
2,4]); // 2x2, integer matrix
B.UpperTriangle(A,true,true);
// B becomes:
// [1,2,
// [0,4]
MtxVec.FreeIt(ref A, ref B);
See Also: TMtxInt.LowerTriangle