// output of ./demo/perm/cycles-demo.cc:
// Description:
//% Decomposition of a permutation into cycles.
//% Print cycles and code for the permutation.

arg 1: 4 == ldn  [Number of elements is 2**ldn]  default=4
  n=16
arg 2: 1 == pcq  [How to print code: 0==>no code, 1==>to stdout, 2==>stderr.]  default=1
 Apply some permutation:
Using: gray_permute(y, n)
Computing cycles:
  0:  (  2,  3) #=2
  1:  (  4,  7,  5,  6) #=4
  2:  (  8, 15, 10, 12) #=4
  3:  (  9, 14, 11, 13) #=4
  14 elements in   4 nontrivial cycles.
 cycle lengths:   2 ...   4
number of fixed points = 2
[0. 1]
 ===== start printing CODE  =====
template <typename Type>
inline void
foo_perm_16(Type *f)
// unrolled version for length 16
{
  swap2(f[2], f[3]);
  { Type t=f[4]; f[4]=f[7]; f[7]=f[5]; f[5]=f[6]; f[6]=t; }
  { Type t=f[8]; f[8]=f[15]; f[15]=f[10]; f[10]=f[12]; f[12]=t; }
  { Type t=f[9]; f[9]=f[14]; f[14]=f[11]; f[11]=f[13]; f[13]=t; }
}
 ===== end (printing CODE)  =====
