Algosim documentation: ToUpperTriangular

ToUpperTriangular

Makes a matrix upper triangular.

Syntax

Description

If A is a matrix, not necessarily square, then ToUpperTriangular(A) returns the matrix obtained from A by setting all entries below the main diagonal to 0.

Examples

A ≔ ❨❨5, 1, 2, 3, 6❩, ❨1, 2, 3, 6, 7❩, ❨4, 1, 2, 3, 8❩, ❨0, 1, 2, 6, 1❩❩
⎛5  1  2  3  6⎞
⎜1  2  3  6  7⎟
⎜4  1  2  3  8⎟
⎝0  1  2  6  1⎠
ToUpperTriangular(A)
⎛5  1  2  3  6⎞
⎜0  2  3  6  7⎟
⎜0  0  2  3  8⎟
⎝0  0  0  6  1⎠

See also