UpperTriangularize
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 subdiagonal of m.
Details

- UpperTriangularize[m] works even if m is not a square matrix.
- In UpperTriangularize[m,k], positive k refers to subdiagonals above the main diagonal and negative k refers to subdiagonals below the main diagonal.
- UpperTriangularize works with SparseArray objects.
Examples
open allclose allBasic Examples (2)
Scope (12)
Basic Uses (8)
Get the upper-triangular part of non-square matrices:
Find the upper-triangular part of a machine-precision matrix:
Upper-triangular part of a complex matrix:
Upper-triangular part of an exact matrix:
Upper-triangular part of an arbitrary-precision matrix:
Compute the upper-triangular part of a symbolic matrix:
Large matrices are handled efficiently:
The number of rows or columns limits the meaningful values of the parameter k:
Special Matrices (4)
The upper-triangular part of a sparse matrix is returned as a sparse matrix:
The upper-triangular part of structured matrices:
The upper-triangular part of an identity matrix is the matrix itself:
This is true of any diagonal matrix:
Compute the the upper-triangular part, including the subdiagonal, for HilbertMatrix:
Properties & Relations (2)
Matrices returned by UpperTriangularize satisfy UpperTriangularMatrixQ:
UpperTriangularize[m,k] is equivalent to Transpose[LowerTriangularize[Transpose[m],-k]]:
Text
Wolfram Research (2008), UpperTriangularize, Wolfram Language function, https://reference.wolfram.com/language/ref/UpperTriangularize.html.
BibTeX
BibLaTeX
CMS
Wolfram Language. 2008. "UpperTriangularize." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UpperTriangularize.html.
APA
Wolfram Language. (2008). UpperTriangularize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UpperTriangularize.html