MTM
triu
compute the upper triangular matrix
Calling Sequence
Parameters
Description
Examples
triu(A)
triu(A,k)
A
-
matrix, vector, array, or scalar
k
(optional) integer
For a matrix A, the triu(A) command returns a matrix R where R[i,j] = A[i,j] when R[i,j] is on or above the main diagonal of R. R[i,j] = 0 otherwise.
For a matrix A, the triu(A,k) command returns a matrix R where R[i,j] = A[i,j] when R[i,j] is on or above the diagonal of R indexed by k. R[i,j] = 0 otherwise.
The diagonals of a matrix are indexed using signed integers, where the main diagonal has index 0. Superdiagonals are indexed with positive integers and subdiagonals are indexed with negative integers.
with⁡MTM:
A≔Matrix⁡1,2,1,4,5,6,2,8,1
A≔121456281
triu⁡A
121056001
triu⁡A,1
021006000
triu⁡A,−1
121456081
See Also
MTM[diag]
MTM[tril]
triangular
Download Help Document