TRIU

Purpose:

Returns the upper triangle of a matrix.

Syntax:

TRIU(a, d)

a

-

A matrix.

d

-

Optional. An integer, the diagonal on and above which to include matrix elements. Defaults to 0, the main diagonal.

Returns:

An array consisting of the upper triangle of a where the other elements are zero.

Example:

W1: {{1, 2, 3},

     {4, 5, 6}, 

     {7, 8, 9}} 

 

W2: triu(W1)

 

W2 == {{1, 2, 3},

       {0, 5, 6}, 

       {0, 0, 9}} 

 

 

W3: triu(W1, 1)

 

W3 == {{0, 2, 3},

       {0, 0, 6}, 

       {0, 0, 0}} 

 

 

W4: triu(W1, -1)

 

W4 == {{1, 2, 3},

       {4, 5, 6}, 

       {0, 8, 9}} 

Remarks:

TRIU(a, 1) is equivalent to UPTRIX(a).

 

See TRIL to return the lower matrix.

See Also:

COLNOS

DIAGONAL

LOTRIX

ROWNOS

TRIL

UPTRI

UPTRIX