demomat {lazy.irtx} | R Documentation |
This can create either symbobic or numeric matrices.
demomat(nr, nc, n3 = 0, root = NULL, vec = 0, shape = NULL, nodiag = 0, supermat = 0, list = 0, mul = NULL, mul3 = NULL, rnroot = "r", cnroot = "c", anroot = "a")
nr |
# of rows of the matrix to be generated or a vector consisting of the # of rows of each submatrix. |
nc |
# of columns of the matrix to be generated or a vector consisting of the # of columns of each submatrix. |
n3 |
# of the 3d dimension, if any |
root |
The root character of symbolic matrix. |
vec |
= 1 to drop the redundant subscript. |
shape |
Shape of the resulting matrix: |
nodiag |
= 1 to set the diagonal elements to 0 when either "upper" or "lower" is specified |
supermat |
= 1 to create horizontally stacked array |
list |
= 1 to return the array as list |
mul |
See below. |
mul3 |
See below. |
rnroot |
root of the row names |
cnroot |
root of the column names |
anroot |
root of the third dimension names |
The i,j elements of a matrix will be named as mul*i + j
The i,j,k elements of an array will be named as mul3*(mul*i + j) + k
When a supermatrix is generated, SMdim attributes will be set
where SMdim is a list of the form (nrows=nr, ncols=nc) where
nr is a vector consisting of the number of rows of each submatrix,
nc is a vector consisting of the number of columns of each submatrix.
A matrix or an array.
Note that even with vec=1 option, thre result is a matrix.
Use c() to convert it to a vector.
demomat( 11,3 ) # numeric demomat( 11,3,root="a" ) # symbolic demomat( 4,1,root="a", vec=1 ) # symbolic demomat( 4,3,2 ) # numeric demomat( 4,3,2, supermat=1 ) # numeric demomat( 4,3,2, supermat=2 ) # numeric demomat( c(4,3),c(3,2) ) # numeric