KrawtchoukMat( n , q )
KrawtchoukMat
returns the <n>+1 by <n>+1 matrix K=(k_{ij})
defined by k_{ij}=K_i(j) for i,j=0,...,n. K_i(j) is the Krawtchouk
number (see Krawtchouk). n must be a positive integer and q a prime
power. The Krawtchouk matrix is used in the MacWilliams identities,
defining the relation between the weight distribution of a code of length
n over a field of size q, and its dual code. Each call to
KrawtchoukMat
returns a new matrix, so it is safe to modify the result.
gap> PrintArray( KrawtchoukMat( 3, 2 ) ); [ [ 1, 1, 1, 1 ], [ 3, 1, -1, -3 ], [ 3, -1, -1, 3 ], [ 1, -1, 1, -1 ] ] gap> C := HammingCode( 3 );; a := WeightDistribution( C ); [ 1, 0, 0, 7, 7, 0, 0, 1 ] gap> n := WordLength( C );; q := Size( Field( C ) );; gap> k := Dimension( C );; gap> q^( -k ) * KrawtchoukMat( n, q ) * a; [ 1, 0, 0, 0, 7, 0, 0, 0 ] gap> WeightDistribution( DualCode( C ) ); [ 1, 0, 0, 0, 7, 0, 0, 0 ]
GAP 3.4.4