supermat {lazy.mat}R Documentation

Declare a supermatrix with SMdim attribute

Description

Declare a supermatrix with SMdim attribute

Usage

supermat(nrows = 1, ncols = 1, initvar = 0)

Arguments

nrows

a vector of rows of each submatrix

ncols

a vector of columns of each submatrix.

initvar

initial value of the elements

Details

About SMdim attribute:
SMdim attribute of a supermatrix is a list of the form (nrows=, ncols=) where
nrows is a vector of rows of each submatrix,
ncols is a vector of columns of each submatrix.

To assign values to each of submatrix, see the example below.
To retrieve the submatrix, use getSM.

Value

a sum(nrow) x sum(ncols) matrix with SMdim attribute: SMdim=list(nrows=nrows,ncols=ncols)

Examples

( SM <- supermat( c(2,3),c(3,4,1) ) )
for( i in 1:2 )
 for( j in 1:3 )
  SM[ getSM(SM,i,j,1)$rows, getSM(SM,i,j,1)$cols ]=10*i+j
SM


[Package lazy.mat version 0.1.3 Index]