Next: tserhelp() Up: MacAnova Help File Previous: triunpack()   Contents

# triupper()

Usage:
 ```triupper(A [,pack:T]), A a matrix ```

Keywords: matrix algebra, variables, combining variables
```triupper(a) returns a matrix d of the same size and shape as a with
d[i,j] = a[i,j] for i <= j (on or above the diagonal) and d[i,j] = 0 for
i > j (below diagonal).  Variable a must be a matrix but need not be
square.
[1   5   9]                   [1   5   9]
For example, when a is  [2   6  10] , triupper(a) is  [0   6  10]
[3   7  11]                   [0   0  11]
[4   8  12]                   [0   0   0]

triupper(a,square:T) returns the m by m upper left block of triupper(a),
where m = min(nrows(a),ncols(a)).

When a has type CHARACTER, elements below the diagonal are sent to empty

triupper(a,T) or triupper(a,pack:T) returns the upper triangle (elements
a[i,j] with i <= j) of a in packed form.  Matrix a must be square, that
is, nrows(a) = ncols(a).  For example, when
[1   4   7]
a =  [2   5   8]
[3   6   9]

triupper(a,pack:T) is vector(1, 4, 5, 7, 8, 9).