circulant               package:magic               R Documentation

_C_i_r_c_u_l_a_n_t _m_a_t_r_i_c_e_s _o_f _a_n_y _o_r_d_e_r

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

     Creates and tests for circulant matrices of any order

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

     circulant(n, vec=1:n)
     is.circulant(m,dir=rep(1,length(dim(m))))

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

       n: Order of circulant matrix in 'circulant()'

     vec: In 'circulant()', vector of elements of the first row,
          defaulting to '1:n'.

       m: In 'is.circulant()', matrix to be tested for circulantism

     dir: In 'is.circulant()', the direction of the diagonal. In a
          matrix, the default value ('c(1,1)') traces the major
          diagonals.

_D_e_t_a_i_l_s:

     A matrix a is circulant if all (major) diagonals are uniform, ie
     if a[i,j]==a[k,j] when i-j=k-l (modulo n).  The standard values to
     use give '1:n' for the top row.

     In the case of arbitrary dimensional arrays, giving the default
     value for 'dir' checks that
     'a[v]==a[v+rep(1,d)]==...=a[v+rep((n-1),d)]' for all 'v' (that is,
     following lines parallel to the major diagonal); indices are
     passed through 'process()'.

     For general 'dir', the function checks that
     'a[v]==a[v+dir]==a[v+2*dir]==...==a[v+(n-1)*d]' for all 'v'.

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

     Robin K. S. Hankin

_R_e_f_e_r_e_n_c_e_s:

     Arthur T. Benjamin and K. Yasuda.  _Magic "Squares" Indeed!_,
     American Mathematical Monthly, vol 106(2), pp152-156, Feb 1999

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

     circulant(5)
     circulant(5,vec=2^(0:4))
     is.circulant(circulant(5))

      a <- outer(1:3,1:3,"+")%%3
      is.circulant(a)
      is.circulant(a,c(1,2))

      is.circulant(array(c(1:4,4:1),rep(2,3)))

      is.circulant(magic(5)%%5,c(2,-1))

