Extract the upper triangular part of a matrix.
Arguments
- x
A matrix.
- k
The sub-diagonal at and below which the matrix is filled.
k = 0is the main diagonal, whilek< 0 is below it, andk> 0 is above. The default is 0.- diag
Logical indicating whether to include the diagonal. Default is
TRUE.