allsubhypercubes {magic} | R Documentation |
Extracts all subhypercubes from an n-dimensional hypercube.
allsubhypercubes(a)
a |
The magic hypercube whose subhypercubes are computed |
Returns a list, each element of which is a subhypercube. Note that major diagonals are also returned (as n-by-1 arrays).
This function is a dog's dinner. It's complicated, convoluted,
and needs two absurd uses of the eval(parse(text=...))
construction. Basically it sucks big time.
BUT... I cannot for the life of me see a better way that gives the same results, without loops, on hypercubes of arbitrary dimension.
The function cannot cope with d
as high as 5, for n=4
.
Heigh ho.
Robin K. S. Hankin
library(abind) a <- magichypercube.4n(1,d=4) allsubhypercubes(a)