allsubhypercubes            package:magic            R Documentation

_S_u_b_h_y_p_e_r_c_u_b_e_s _o_f _m_a_g_i_c _h_y_p_e_r_c_u_b_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Extracts all subhypercubes from an n-dimensional hypercube.

_U_s_a_g_e:

     allsubhypercubes(a)

_A_r_g_u_m_e_n_t_s:

       a: The magic hypercube whose subhypercubes are computed

_V_a_l_u_e:

     Returns a list, each element of which is a subhypercube.  Note
     that major diagonals are also returned (as n-by-1 arrays).

     The names of the list are the extracted subhypercubes.  Consider
     'a <- magichypercube.4n(1,d=4)' (so n=4) and if 'jj <-
     allsubhypercubes(a)', consider 'jj[9]'.  The name of 'jj[9]' is
     '"n-i+1,i,i,"'; its value is a square matrix.  The columns of
     'jj[9]' may be recovered by 'a[n-i+1,i,i,]' with i=1...n (NB: that
     is, 'rbind(a[n-1+1,1,1,], a[n-2+1,2,2,], a[n-3+1,3,3,],
     a[n-4+1,4,4,])' where 'n=4').

     The list does not inlude the whole array.

_N_o_t_e:

     This function is a dog's dinner.  It's complicated, convoluted,
     and needs an absurd use 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.

     On my 256MB Linuxbox, 'allsubhypercubes()' cannot cope with 'd' as
     high as 5, for 'n=4'.  Heigh ho.

_A_u_t_h_o_r(_s):

     Robin K. S. Hankin

_S_e_e _A_l_s_o:

     'is.perfect'

_E_x_a_m_p_l_e_s:

       a <- magichypercube.4n(1,d=4)
       allsubhypercubes(a)

