demomat {lazy.irtx}R Documentation

Set up a matrix whose elements consist of row and col numbers.

Description

This can create either symbobic or numeric matrices.

Usage

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")

Arguments

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.
If this is present, a character matrix/array will be created.

vec

= 1 to drop the redundant subscript.

shape

Shape of the resulting matrix:
"sym", "symU", "symL", "diag", "uppert", "lowert"

nodiag

= 1 to set the diagonal elements to 0 when either "upper" or "lower" is specified

supermat

= 1 to create horizontally stacked array
= 2 to create vertically stacked array
= 0 othereize

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

Details

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.

Value

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.

Examples

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


[Package lazy.irtx version 1.0.1 Index]