UpperTriangularize

UpperTriangularize[m]

gives a matrix in which all but the upper triangular elements of m are replaced with zeros.

UpperTriangularize[m,k]

replaces with zeros only the elements below the k^(th) subdiagonal of m.

Details

Examples

open allclose all

Basic Examples  (2)

Get the upper triangular part of a matrix:

Get the strictly upper triangular part of a matrix:

Scope  (2)

Get the upper triangular part of nonsquare matrices:

The number of rows or columns limits the meaningful values of the parameter k:

Properties & Relations  (2)

Matrices returned by UpperTriangularize satisfy UpperTriangularMatrixQ:

UpperTriangularize[m,k] is equivalent to Transpose[LowerTriangularize[Transpose[m],-k]]:

Introduced in 2008
 (7.0)