findex (i, dim, config=TRUE)
config
is TRUE
) of
configurations or a vector (if config
is FALSE
) of indices.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
.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.dims <- c(3,2,4)
findex(findex(1:4,dims,config=FALSE),dims)
Run the code above in your browser using DataLab