Learn R Programming

deal (version 1.1-2)

findex: Translation between indices in a multiway array

Description

Translate back and forth between indices in multiway arrays

Usage

findex (i, dim, config=TRUE)

Arguments

i
Either a matrix (config=T) of configurations or a vector (config=F) of indices.
dim
Dimension of multiway array.
config
If TRUE, i is interpreted as a matrix of configurations. If FALSE, i is interpreted as a matrix of indices in the unfolded multiway array with dimension dim.

Details

If config is TRUE, then i is interpreted as a matrix with one row per wanted entry. The columns are the configurations of each of the discrete variables (in the proper order). Returned is a vector of length the number of rows of i. The entries correspond to each row and is the corresponding number if the array were 'folded' out. If config is FALSE, then i is a vector of indices in the unfolded array. We want the corresponding configurations of the discrete variables output is a matrix with one row per configuration. Thus, findex(config=T) and findex(config=F) are each others inverse functions.

References

Further information about Deal can be found at: http://www.math.auc.dk/novo/deal.

Examples

Run this code
dims <- c(3,2,4)
  findex(findex(1:4,dims,config=FALSE),dims)

Run the code above in your browser using DataLab