| findex {deal} | R Documentation |
Translate back and forth between indices in multiway arrays
findex (i, dim, config=TRUE)
i |
either a matrix (if config is TRUE) of
configurations or a vector (if config is FALSE) of indices. |
dim |
a vector of integers giving the dimension of the multiway array. |
config |
a logical. 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. |
This function is intended for internal use.
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=TRUE) and findex(config=FALSE) are each others
inverse functions.
Susanne Gammelgaard Bøttcher alma@math.auc.dk,
Claus Dethlefsen dethlef@math.auc.dk.
Further information about deal can be found at:
http://www.math.auc.dk/novo/deal.
dims <- c(3,2,4) findex(findex(1:4,dims,config=FALSE),dims)