DADiSP Worksheet Functions > Function Categories > Matrix Math and Special Matrices > UPTRI

 

UPTRI

Purpose:

Returns the upper triangle of a matrix, including the main diagonal.

Syntax:

UPTRI(a)

a

-

A matrix.

Returns:

An array of size(a) consisting of the upper triangle of a, including the main diagonal, with the other elements set to 0.

Example:

W1: ones(3)

W2: uptri(W1)

 

W2 == {{1, 1, 1},

       {0, 1, 1}, 

       {0, 0, 1}} 

Remarks:

UPTRI includes the main diagonal. Use UPTRIX to exclude the main diagonal.

 

Use TRIU to return the upper matrix above a specified diagonal.

See Also:

COLNOS

LOTRI

LOTRIX

ROWNOS

TRIU

UPTRIX