Description Usage Arguments Note Examples
Upper triangular matrix making made easy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
entries |
Vector of entries for the upper triangular part of the matrix. |
row |
Number of rows in the matrix |
col |
Number of columns in the matrix |
blanks |
What should go in the non-diagonal entries? |
byRow |
Logical; read the |
incDiag |
Should the entries go on the diagonal too? |
nrow, ncol |
When I first made this function, I used |
len |
Vector of positive integers which specify the lengths of the
individual vectors that are pooled in |
Use makeuppertri
to make a matrix. If you want entries to be
vectors (which would have to be an array with list entries), use
makeuppertri.list
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Square matrices
makeuppertri(1:choose(5,2), 5, 5)
makeuppertri(1:choose(6,2), 5, 5, incDiag = TRUE)
## Not square.
makeuppertri(1:9, row = 2, col = 5, incDiag = TRUE)
makeuppertri(1:3, row = 5, col = 3)
## List entries
(M <- makeuppertri.list(1:12, c(1, 10, 1), 3, 3))
M[1, 2] # A list of length one.
M[1, 3] # Another list of length one.
(M <- makeuppertri.list(1:3, rep(1,3), 3, 3))
M[1, 2] # Still a list of length one.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.