  
  [1X5. Generating Codes[0X
  
  In this chapter we describe functions for generating codes.
  
  Section [14X5.1[0X describes functions for generating unrestricted codes.
  
  Section [14X5.2[0X describes functions for generating linear codes.
  
  Section  [14X5.3[0X  describes  functions  for constructing certain covering codes,
  such as the Gabidulin codes.
  
  Section [14X5.4[0X describes functions for constructing the Golay codes.
  
  Section [14X5.5[0X describes functions for generating cyclic codes.
  
  Section  [14X5.6[0X  describes  functions  for  generating codes as the image of an
  evaluation  map  applied  to  a space of functions. For example, generalized
  Reed-Solomon codes and toric codes are described there.
  
  Section [14X5.7[0X describes functions for generating algebraic geometry codes.
  
  Section  [14X5.8[0X  describes  functions for constructing low-density parity-check
  (LDPC) codes.
  
  
  [1X5.1 Generating Unrestricted Codes[0X
  
  In this section we start with functions that creating code from user defined
  matrices   or  special  matrices  (see  [2XElementsCode[0X  ([14X5.1-1[0X),  [2XHadamardCode[0X
  ([14X5.1-2[0X),  [2XConferenceCode[0X  ([14X5.1-3[0X)  and  [2XMOLSCode[0X  ([14X5.1-4[0X)).  These codes are
  unrestricted codes; they may later be discovered to be linear or cyclic.
  
  The  next  functions  generate random codes (see [2XRandomCode[0X ([14X5.1-5[0X)) and the
  Nordstrom-Robinson code (see [2XNordstromRobinsonCode[0X ([14X5.1-6[0X)), respectively.
  
  Finally,  we  describe  two functions for generating Greedy codes. These are
  codes  that  contructed  by gathering codewords from a space (see [2XGreedyCode[0X
  ([14X5.1-7[0X) and [2XLexiCode[0X ([14X5.1-8[0X)).
  
  [1X5.1-1 ElementsCode[0X
  
  [2X> ElementsCode( [0X[3XL[, name], F[0X[2X ) _____________________________________[0Xfunction
  
  [10XElementsCode[0X  creates an unrestricted code of the list of elements [3XL[0X, in the
  field  [3XF[0X.  [3XL[0X  must  be a list of vectors, strings, polynomials or codewords.
  [3Xname[0X can contain a short description of the code.
  
  If  [3XL[0X  contains a codeword more than once, it is removed from the list and a
  GAP set is returned.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> M := Z(3)^0 * [ [1, 0, 1, 1], [2, 2, 0, 0], [0, 1, 2, 2] ];;[0X
    [4Xgap> C := ElementsCode( M, "example code", GF(3) );[0X
    [4Xa (4,3,1..4)2 example code over GF(3)[0X
    [4Xgap> MinimumDistance( C );[0X
    [4X4[0X
    [4Xgap> AsSSortedList( C );[0X
    [4X[ [ 0 1 2 2 ], [ 1 0 1 1 ], [ 2 2 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-2 HadamardCode[0X
  
  [2X> HadamardCode( [0X[3XH[, t][0X[2X ) ___________________________________________[0Xfunction
  
  The four forms this command can take are [10XHadamardCode(H,t)[0X, [10XHadamardCode(H)[0X,
  [10XHadamardCode(n,t)[0X, and [10XHadamardCode(n)[0X.
  
  In  the case when the arguments [3XH[0X and [3Xt[0X are both given, [10XHadamardCode[0X returns
  a  Hadamard  code of the t^th kind from the Hadamard matrix [3XH[0X In case only [3XH[0X
  is given, t = 3 is used.
  
  By definition, a Hadamard matrix is a square matrix [3XH[0X with H* H^T = -n* I_n,
  where n is the size of [3XH[0X. The entries of [3XH[0X are either 1 or -1.
  
  The  matrix [3XH[0X is first transformed into a binary matrix A_n by replacing the
  1's by 0's and the -1's by 1s).
  
  The  Hadamard matrix of the [13Xfirst kind[0X (t=1) is created by using the rows of
  A_n  as  elements,  after deleting the first column. This is a (n-1, n, n/2)
  code.  We  use  this  code for creating the Hadamard code of the [13Xsecond kind[0X
  (t=2), by adding all the complements of the already existing codewords. This
  results  in  a  (n-1,  2n,  n/2 -1) code. The [13Xthird kind[0X (t=3) is created by
  using  the  rows  of A_n (without cutting a column) and their complements as
  elements.  This  way,  we  have  an  (n, 2n, n/2)-code. The returned code is
  generally an unrestricted code, but for n = 2^r, the code is linear.
  
  The  command  [10XHadamardCode(n,t)[0X  returns a Hadamard code with parameter [3Xn[0X of
  the t^th kind. For the command [10XHadamardCode(n)[0X, t=3 is used.
  
  When  called  in  these  forms, [10XHadamardCode[0X first creates a Hadamard matrix
  (see  [2XHadamardMat[0X ([14X7.3-4[0X)), of size [3Xn[0X and then follows the same procedure as
  described  above.  Therefore  the same restrictions with respect to [3Xn[0X as for
  Hadamard matrices hold.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> H4 := [[1,1,1,1],[1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]];;[0X
    [4Xgap> HadamardCode( H4, 1 );[0X
    [4Xa (3,4,2)1 Hadamard code of order 4 over GF(2)[0X
    [4Xgap> HadamardCode( H4, 2 );[0X
    [4Xa (3,8,1)0 Hadamard code of order 4 over GF(2)[0X
    [4Xgap> HadamardCode( H4 );[0X
    [4Xa (4,8,2)1 Hadamard code of order 4 over GF(2) [0X
    [4Xgap> H4 := [[1,1,1,1],[1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]];;[0X
    [4Xgap> C := HadamardCode( 4 );[0X
    [4Xa (4,8,2)1 Hadamard code of order 4 over GF(2)[0X
    [4Xgap> C = HadamardCode( H4 );[0X
    [4Xtrue [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-3 ConferenceCode[0X
  
  [2X> ConferenceCode( [0X[3XH[0X[2X ) ______________________________________________[0Xfunction
  
  [10XConferenceCode[0X  returns  a  code  of length n-1 constructed from a symmetric
  'conference  matrix' [3XH[0X. A [13Xconference matrix[0X [3XH[0X is a symmetric matrix of order
  n,  which  satisfies  H*  H^T  =  ((n-1)*  I,  with n = 2 mod 4. The rows of
  frac12(H+I+J),  frac12(-H+I+J),  plus the zero and all-ones vectors form the
  elements of a binary non-linear (n-1, 2n, (n-2)/2) code.
  
  [5XGUAVA[0X constructs a symmetric conference matrix of order n+1 (n= 1 mod 4) and
  uses  the  rows  of  that  matrix,  plus  the  zero and all-ones vectors, to
  construct a binary non-linear (n, 2(n+1), (n-1)/2)-code.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> H6 := [[0,1,1,1,1,1],[1,0,1,-1,-1,1],[1,1,0,1,-1,-1],[0X
    [4X> [1,-1,1,0,1,-1],[1,-1,-1,1,0,1],[1,1,-1,-1,1,0]];;[0X
    [4Xgap> C1 := ConferenceCode( H6 );[0X
    [4Xa (5,12,2)1..4 conference code over GF(2)[0X
    [4Xgap> IsLinearCode( C1 );[0X
    [4Xfalse [0X
    [4Xgap> C2 := ConferenceCode( 5 );[0X
    [4Xa (5,12,2)1..4 conference code over GF(2)[0X
    [4Xgap> AsSSortedList( C2 );[0X
    [4X[ [ 0 0 0 0 0 ], [ 0 0 1 1 1 ], [ 0 1 0 1 1 ], [ 0 1 1 0 1 ], [ 0 1 1 1 0 ], [0X
    [4X  [ 1 0 0 1 1 ], [ 1 0 1 0 1 ], [ 1 0 1 1 0 ], [ 1 1 0 0 1 ], [ 1 1 0 1 0 ], [0X
    [4X  [ 1 1 1 0 0 ], [ 1 1 1 1 1 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-4 MOLSCode[0X
  
  [2X> MOLSCode( [0X[3X[n][,]q[0X[2X ) ______________________________________________[0Xfunction
  
  [10XMOLSCode[0X  returns an (n, q^2, n-1) code over GF(q). The code is created from
  n-2  'Mutually  Orthogonal  Latin Squares' (MOLS) of size q x q. The default
  for  [3Xn[0X  is 4. [5XGUAVA[0X can construct a MOLS code for n-2 <= q. Here [3Xq[0X must be a
  prime power, q > 2. If there are no n-2 MOLS, an error is signalled.
  
  Since  each  of  the n-2 MOLS is a qx q matrix, we can create a code of size
  q^2  by  listing  in  each  code  element  the  entries that are in the same
  position  in  each  of the MOLS. We precede each of these lists with the two
  coordinates that specify this position, making the word length become n.
  
  The MOLS codes are MDS codes (see [2XIsMDSCode[0X ([14X4.3-7[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := MOLSCode( 6, 5 );[0X
    [4Xa (6,25,5)3..4 code generated by 4 MOLS of order 5 over GF(5)[0X
    [4Xgap> mols := List( [1 .. WordLength(C1) - 2 ], function( nr )[0X
    [4X>       local ls, el;[0X
    [4X>       ls := NullMat( Size(LeftActingDomain(C1)), Size(LeftActingDomain(C1)) );[0X
    [4X>       for el in VectorCodeword( AsSSortedList( C1 ) ) do[0X
    [4X>          ls[IntFFE(el[1])+1][IntFFE(el[2])+1] := el[nr + 2];[0X
    [4X>       od;[0X
    [4X>       return ls;[0X
    [4X>    end );;[0X
    [4Xgap> AreMOLS( mols );[0X
    [4Xtrue[0X
    [4Xgap> C2 := MOLSCode( 11 );[0X
    [4Xa (4,121,3)2 code generated by 2 MOLS of order 11 over GF(11) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-5 RandomCode[0X
  
  [2X> RandomCode( [0X[3Xn, M, F[0X[2X ) ____________________________________________[0Xfunction
  
  [10XRandomCode[0X  returns  a random unrestricted code of size [3XM[0X with word length [3Xn[0X
  over  [3XF[0X. [3XM[0X must be less than or equal to the number of elements in the space
  GF(q)^n.
  
  The   function   [10XRandomLinearCode[0X   returns   a   random  linear  code  (see
  [2XRandomLinearCode[0X ([14X5.2-12[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := RandomCode( 6, 10, GF(8) );[0X
    [4Xa (6,10,1..6)4..6 random unrestricted code over GF(8)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X3[0X
    [4Xgap> C2 := RandomCode( 6, 10, GF(8) );[0X
    [4Xa (6,10,1..6)4..6 random unrestricted code over GF(8)[0X
    [4Xgap> C1 = C2;[0X
    [4Xfalse [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-6 NordstromRobinsonCode[0X
  
  [2X> NordstromRobinsonCode( [0X[3X[0X[2X ) ________________________________________[0Xfunction
  
  [10XNordstromRobinsonCode[0X  returns a Nordstrom-Robinson code, the best code with
  word  length  n=16 and minimum distance d=6 over GF(2). This is a non-linear
  (16, 256, 6) code.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := NordstromRobinsonCode();[0X
    [4Xa (16,256,6)4 Nordstrom-Robinson code over GF(2)[0X
    [4Xgap> OptimalityCode( C );[0X
    [4X0 [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-7 GreedyCode[0X
  
  [2X> GreedyCode( [0X[3XL, d, F[0X[2X ) ____________________________________________[0Xfunction
  
  [10XGreedyCode[0X  returns  a  Greedy  code  with design distance [3Xd[0X over the finite
  field  [3XF[0X.  The code is constructed using the greedy algorithm on the list of
  vectors  [3XL[0X. (The greedy algorithm checks each vector in [3XL[0X and adds it to the
  code  if  its distance to the current code is greater than or equal to [3Xd[0X. It
  is obvious that the resulting code has a minimum distance of at least [3Xd[0X.
  
  Greedy codes are often linear codes.
  
  The  function  [10XLexiCode[0X  creates  a  greedy  code from a basis instead of an
  enumerated list (see [2XLexiCode[0X ([14X5.1-8[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := GreedyCode( Tuples( AsSSortedList( GF(2) ), 5 ), 3, GF(2) );[0X
    [4Xa (5,4,3..5)2 Greedy code, user defined basis over GF(2)[0X
    [4Xgap> C2 := GreedyCode( Permuted( Tuples( AsSSortedList( GF(2) ), 5 ),[0X
    [4X>                         (1,4) ), 3, GF(2) );[0X
    [4Xa (5,4,3..5)2 Greedy code, user defined basis over GF(2)[0X
    [4Xgap> C1 = C2;[0X
    [4Xfalse [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.1-8 LexiCode[0X
  
  [2X> LexiCode( [0X[3Xn, d, F[0X[2X ) ______________________________________________[0Xfunction
  
  In  this  format,  [10XLexicode[0X  returns  a  lexicode with word length [3Xn[0X, design
  distance [3Xd[0X over [3XF[0X. The code is constructed using the greedy algorithm on the
  lexicographically ordered list of all vectors of length [3Xn[0X over [3XF[0X. Every time
  a  vector is found that has a distance to the current code of at least [3Xd[0X, it
  is  added  to  the  code.  This  results,  obviously, in a code with minimum
  distance greater than or equal to [3Xd[0X.
  
  Another syntax which one can use is [10XLexiCode( B, d, F )[0X. When called in this
  format,  [10XLexiCode[0X  uses  the  basis  [3XB[0X instead of the standard basis. [3XB[0X is a
  matrix of vectors over [3XF[0X. The code is constructed using the greedy algorithm
  on  the list of vectors spanned by [3XB[0X, ordered lexicographically with respect
  to [3XB[0X.
  
  Note that binary lexicodes are always linear.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := LexiCode( 4, 3, GF(5) );[0X
    [4Xa (4,17,3..4)2..4 lexicode over GF(5) [0X
    [4Xgap> B := [ [Z(2)^0, 0*Z(2), 0*Z(2)], [Z(2)^0, Z(2)^0, 0*Z(2)] ];;[0X
    [4Xgap> C := LexiCode( B, 2, GF(2) );[0X
    [4Xa linear [3,1,2]1..2 lexicode over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  The  function  [10XGreedyCode[0X  creates a greedy code that is not restricted to a
  lexicographical order (see [2XGreedyCode[0X ([14X5.1-7[0X)).
  
  
  [1X5.2 Generating Linear Codes[0X
  
  In  this  section  we  describe  functions  for constructing linear codes. A
  linear code always has a generator or check matrix.
  
  The  first  two  functions  generate  linear codes from the generator matrix
  ([2XGeneratorMatCode[0X  ([14X5.2-1[0X))  or  check  matrix  ([2XCheckMatCode[0X  ([14X5.2-3[0X)). All
  linear codes can be constructed with these functions.
  
  The  next functions we describe generate some well-known codes, like Hamming
  codes  ([2XHammingCode[0X ([14X5.2-4[0X)), Reed-Muller codes ([2XReedMullerCode[0X ([14X5.2-5[0X)) and
  the    extended    Golay    codes   ([2XExtendedBinaryGolayCode[0X   ([14X5.4-2[0X)   and
  [2XExtendedTernaryGolayCode[0X ([14X5.4-4[0X)).
  
  A  large and powerful family of codes are alternant codes. They are obtained
  by  a  small  modification  of  the  parity  check matrix of a BCH code (see
  [2XAlternantCode[0X  ([14X5.2-6[0X), [2XGoppaCode[0X ([14X5.2-7[0X), [2XGeneralizedSrivastavaCode[0X ([14X5.2-8[0X)
  and [2XSrivastavaCode[0X ([14X5.2-9[0X)).
  
  Finally,  we  describe  a  function  for generating random linear codes (see
  [2XRandomLinearCode[0X ([14X5.2-12[0X)).
  
  [1X5.2-1 GeneratorMatCode[0X
  
  [2X> GeneratorMatCode( [0X[3XG[, name], F[0X[2X ) _________________________________[0Xfunction
  
  [10XGeneratorMatCode[0X  returns a linear code with generator matrix [3XG[0X. [3XG[0X must be a
  matrix  over  finite  field  [3XF[0X.  [3Xname[0X can contain a short description of the
  code.  The  generator  matrix  is the basis of the elements of the code. The
  resulting  code  has  word  length n, dimension k if [3XG[0X is a k x n-matrix. If
  GF(q) is the field of the code, the size of the code will be q^k.
  
  If  the generator matrix does not have full row rank, the linearly dependent
  rows are removed. This is done by the GAP function [10XBaseMat[0X and results in an
  equal  code.  The  generator  matrix  can  be  retrieved  with  the function
  [10XGeneratorMat[0X (see [2XGeneratorMat[0X ([14X4.7-1[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G := Z(3)^0 * [[1,0,1,2,0],[0,1,2,1,1],[0,0,1,2,1]];;[0X
    [4Xgap> C1 := GeneratorMatCode( G, GF(3) );[0X
    [4Xa linear [5,3,1..2]1..2 code defined by generator matrix over GF(3)[0X
    [4Xgap> C2 := GeneratorMatCode( IdentityMat( 5, GF(2) ), GF(2) );[0X
    [4Xa linear [5,5,1]0 code defined by generator matrix over GF(2)[0X
    [4Xgap> GeneratorMatCode( List( AsSSortedList( NordstromRobinsonCode() ),[0X
    [4X> x -> VectorCodeword( x ) ), GF( 2 ) );[0X
    [4Xa linear [16,11,1..4]2 code defined by generator matrix over GF(2)[0X
    [4X# This is the smallest linear code that contains the N-R code [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-2 CheckMatCodeMutable[0X
  
  [2X> CheckMatCodeMutable( [0X[3XH[, name], F[0X[2X ) ______________________________[0Xfunction
  
  [10XCheckMatCodeMutable[0X is the same as [10XCheckMatCode[0X except that the check matrix
  and generator matrix are mutable.
  
  [1X5.2-3 CheckMatCode[0X
  
  [2X> CheckMatCode( [0X[3XH[, name], F[0X[2X ) _____________________________________[0Xfunction
  
  [10XCheckMatCode[0X  returns  a linear code with check matrix [3XH[0X. [3XH[0X must be a matrix
  over Galois field [3XF[0X. [3X[name.[0X can contain a short description of the code. The
  parity  check  matrix  is  the transposed of the nullmatrix of the generator
  matrix of the code. Therefore, c* H^T = 0 where c is an element of the code.
  If  [3XH[0X  is  a  rx  n-matrix,  the  code  has  word length n, redundancy r and
  dimension n-r.
  
  If the check matrix does not have full row rank, the linearly dependent rows
  are  removed.  This  is  done by the GAP function [10XBaseMat[0X. and results in an
  equal  code.  The  check  matrix can be retrieved with the function [10XCheckMat[0X
  (see [2XCheckMat[0X ([14X4.7-2[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G := Z(3)^0 * [[1,0,1,2,0],[0,1,2,1,1],[0,0,1,2,1]];;[0X
    [4Xgap> C1 := CheckMatCode( G, GF(3) );[0X
    [4Xa linear [5,2,1..2]2..3 code defined by check matrix over GF(3)[0X
    [4Xgap> CheckMat(C1);[0X
    [4X[ [ Z(3)^0, 0*Z(3), Z(3)^0, Z(3), 0*Z(3) ],[0X
    [4X  [ 0*Z(3), Z(3)^0, Z(3), Z(3)^0, Z(3)^0 ],[0X
    [4X  [ 0*Z(3), 0*Z(3), Z(3)^0, Z(3), Z(3)^0 ] ][0X
    [4Xgap> C2 := CheckMatCode( IdentityMat( 5, GF(2) ), GF(2) );[0X
    [4Xa cyclic [5,0,5]5 code defined by check matrix over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-4 HammingCode[0X
  
  [2X> HammingCode( [0X[3Xr, F[0X[2X ) ______________________________________________[0Xfunction
  
  [10XHammingCode[0X  returns a Hamming code with redundancy [3Xr[0X over [3XF[0X. A Hamming code
  is a single-error-correcting code. The parity check matrix of a Hamming code
  has  all  nonzero  vectors  of  length  [3Xr[0X  in  its  columns,  except  for  a
  multiplication  factor.  The  decoding  algorithm  of  the Hamming code (see
  [2XDecode[0X ([14X4.10-1[0X)) makes use of this property.
  
  If  q  is  the  size  of  its field [3XF[0X, the returned Hamming code is a linear
  [(q^r-1)/(q-1), (q^r-1)/(q-1) - r, 3] code.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := HammingCode( 4, GF(2) );[0X
    [4Xa linear [15,11,3]1 Hamming (4,2) code over GF(2)[0X
    [4Xgap> C2 := HammingCode( 3, GF(9) );[0X
    [4Xa linear [91,88,3]1 Hamming (3,9) code over GF(9) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-5 ReedMullerCode[0X
  
  [2X> ReedMullerCode( [0X[3Xr, k[0X[2X ) ___________________________________________[0Xfunction
  
  [10XReedMullerCode[0X  returns a binary 'Reed-Muller code' [3XR(r, k)[0X with dimension [3Xk[0X
  and  order [3Xr[0X. This is a code with length 2^k and minimum distance 2^k-r (see
  for  example,  section 1.10 in [HP03]). By definition, the r^th order binary
  Reed-Muller code of length n=2^m, for 0 <= r <= m, is the set of all vectors
  f, where f is a Boolean function which is a polynomial of degree at most r.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ReedMullerCode( 1, 3 );[0X
    [4Xa linear [8,4,4]2 Reed-Muller (1,3) code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  See [2XGeneralizedReedMullerCode[0X ([14X5.6-3[0X) for a more general construction.
  
  [1X5.2-6 AlternantCode[0X
  
  [2X> AlternantCode( [0X[3Xr, Y[, alpha], F[0X[2X ) ________________________________[0Xfunction
  
  [10XAlternantCode[0X  returns  an  'alternant code', with parameters [3Xr[0X, [3XY[0X and [3Xalpha[0X
  (optional).  [3XF[0X  denotes  the  (finite)  base  field.  Here,  [3Xr[0X is the design
  redundancy  of the code. [3XY[0X and [3Xalpha[0X are both vectors of length [3Xn[0X from which
  the  parity  check  matrix  is  constructed.  The  check matrix has the form
  H=([a_i^j  y_i]),  where  0 <= j<= r-1, 1 <= i<= n, and where [...] is as in
  [2XVerticalConversionFieldMat[0X  ([14X7.3-9[0X)).  If  no [3Xalpha[0X is specified, the vector
  [1,  a,  a^2, .., a^n-1] is used, where a is a primitive element of a Galois
  field [3XF[0X.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> Y := [ 1, 1, 1, 1, 1, 1, 1];; a := PrimitiveUnityRoot( 2, 7 );;[0X
    [4Xgap> alpha := List( [0..6], i -> a^i );;[0X
    [4Xgap> C := AlternantCode( 2, Y, alpha, GF(8) );[0X
    [4Xa linear [7,3,3..4]3..4 alternant code over GF(8) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-7 GoppaCode[0X
  
  [2X> GoppaCode( [0X[3XG, L[0X[2X ) ________________________________________________[0Xfunction
  
  [10XGoppaCode[0X   returns   a  Goppa  code  [3XC[0X  from  Goppa  polynomial  [3Xg[0X,  having
  coefficients in a Galois Field GF(q). [3XL[0X must be a list of elements in GF(q),
  that  are not roots of [3Xg[0X. The word length of the code is equal to the length
  of  [3XL[0X.  The  parity check matrix has the form H=([a_i^j / G(a_i)])_0 <= j <=
  deg(g)-1,    a_i    in   L,   where   a_iin   L   and   [...]   is   as   in
  [2XVerticalConversionFieldMat[0X  ([14X7.3-9[0X), so H has entries in GF(q), q=p^m. It is
  known  that d(C)>= deg(g)+1, with a better bound in the binary case provided
  g  has  no  multiple roots. See Huffman and Pless [HP03] section 13.2.2, and
  MacWilliams and Sloane [MS83] section 12.3, for more details.
  
  One  can  also  call  [10XGoppaCode[0X using the syntax [10XGoppaCode(g,n)[0X. When called
  with  parameter  [3Xn[0X,  [5XGUAVA[0X  constructs  a  list  L of length [3Xn[0X, such that no
  element of [3XL[0X is a root of [3Xg[0X.
  
  This is a special case of an alternant code.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> x:=Indeterminate(GF(8),"x");[0X
    [4Xx[0X
    [4Xgap> L:=Elements(GF(8));[0X
    [4X[ 0*Z(2), Z(2)^0, Z(2^3), Z(2^3)^2, Z(2^3)^3, Z(2^3)^4, Z(2^3)^5, Z(2^3)^6 ][0X
    [4Xgap> g:=x^2+x+1;[0X
    [4Xx^2+x+Z(2)^0[0X
    [4Xgap> C:=GoppaCode(g,L);[0X
    [4Xa linear [8,2,5]3 Goppa code over GF(2)[0X
    [4Xgap> xx := Indeterminate( GF(2), "xx" );; [0X
    [4Xgap> gg := xx^2 + xx + 1;; L := AsSSortedList( GF(8) );;[0X
    [4Xgap> C1 := GoppaCode( gg, L );[0X
    [4Xa linear [8,2,5]3 Goppa code over GF(2) [0X
    [4Xgap> y := Indeterminate( GF(2), "y" );; [0X
    [4Xgap> h := y^2 + y + 1;;[0X
    [4Xgap> C2 := GoppaCode( h, 8 );[0X
    [4Xa linear [8,2,5]3 Goppa code over GF(2) [0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4Xgap> C=C1;[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-8 GeneralizedSrivastavaCode[0X
  
  [2X> GeneralizedSrivastavaCode( [0X[3Xa, w, z[, t], F[0X[2X ) _____________________[0Xfunction
  
  [10XGeneralizedSrivastavaCode[0X   returns   a  generalized  Srivastava  code  with
  parameters  [3Xa[0X, [3Xw[0X, [3Xz[0X, [3Xt[0X. a = a_1, ..., a_n and w = w_1, ..., w_s are lists of
  n+s  distinct  elements  of  F=GF(q^m),  z  is a list of length n of nonzero
  elements  of GF(q^m). The parameter [3Xt[0X determines the designed distance: d >=
  st + 1. The check matrix of this code is the form
  
  
       H=([\frac{z_i}{(a_i - w_j)^k}]),
  
  
  1<=  k<=  t, where [...] is as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := CordaroWagnerCode( 11 );[0X
    [4Xa linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0X
    [4Xgap> AsSSortedList(C);                 [0X
    [4X[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0X
    [4X  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-11 FerreroDesignCode[0X
  
  [2X> FerreroDesignCode( [0X[3XP, m[0X[2X ) ________________________________________[0Xfunction
  
  [13XRequires the GAP package SONATA[0X
  
  A  group  K  together  with  a  group  of  automorphism H of K such that the
  semidirect  product  KH  is  a Frobenius group with complement H is called a
  Ferrero  pair  (K,  H) in SONATA. Take a Frobenius (G,+) group with kernel K
  and complement H. Consider the design D with point set K and block set a^H +
  b  |  a, b in K, a not= 0. Here a^H denotes the orbit of a under conjugation
  by  elements of H. Every planar near-ring design of type "*" can be obtained
  in  this  way from groups. These designs (from a Frobenius kernel of order v
  and  a  Frobenius  complement  of order k) have v(v-1)/k distinct blocks and
  they  are all of size k. Moreover each of the v points occurs in exactly v-1
  distinct blocks. Hence the rows and the columns of the incidence matrix M of
  the design are always of constant weight.
  
  [10XFerreroDesignCode[0X  constructs  binary  linear code arising from the incdence
  matrix   of  a  design  associated  to  a  "Ferrero  pair"  arising  from  a
  fixed-point-free (fpf) automorphism groups and Frobenius group.
  
  INPUT:  P  is a list of prime powers describing an abelian group G. m > 0 is
  an  integer  such  that  G admits a cyclic fpf automorphism group of size m.
  This  means that for all q = p^k in P, OrderMod(p, m) must divide q (see the
  SONATA documentation for [10XFpfAutomorphismGroupsCyclic[0X).
  
  OUTPUT:  The  binary  linear  code  whose  generator matrix is the incidence
  matrix  of  a  design  associated  to  a  "Ferrero  pair"  arising  from the
  fixed-point-free  (fpf)  automorphism group of G. The pair (H,K) is called a
  Ferraro  pair  and  the  semidirect  product  KH  is  a Frobenius group with
  complement H.
  
  AUTHORS: Peter Mayr and David Joyner
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> G:=AbelianGroup([5,5] );[0X
    [4X [ pc group of size 25 with 2 generators ][0X
    [4Xgap> FpfAutomorphismGroupsMaxSize( G );[0X
    [4X[ 24, 2 ][0X
    [4Xgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0X
    [4X[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0X
    [4X  [ pc group of size 25 with 2 generators ] ][0X
    [4Xgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0X
    [4X [ a 2 - ( 25, 3, 2 ) nearring generated design ][0X
    [4Xgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0X
    [4X25[0X
    [4X200[0X
    [4Xgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> MinimumDistance(C1);[0X
    [4X24[0X
    [4Xgap> C2:=FerreroDesignCode( [5,5],3);[0X
    [4Xa linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0X
    [4Xgap> C1=C2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-12 RandomLinearCode[0X
  
  [2X> RandomLinearCode( [0X[3Xn, k, F[0X[2X ) ______________________________________[0Xfunction
  
  [10XRandomLinearCode[0X  returns a random linear code with word length [3Xn[0X, dimension
  [3Xk[0X  over  field [3XF[0X. The method used is to first construct a kx n matrix of the
  block  form  (I,A),  where  I  is a kx k identity matrix and A is a kx (n-k)
  matrix constructed using [10XRandom(F)[0X repeatedly. Then the columns are permuted
  using a randomly selected element of [10XSymmetricGroup(n)[0X.
  
  To  create  a  random  unrestricted  code,  use  [10XRandomCode[0X  (see [2XRandomCode[0X
  ([14X5.1-5[0X)).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C := RandomLinearCode( 15, 4, GF(3) );[0X
    [4Xa  [15,4,?] randomly generated code over GF(3)[0X
    [4Xgap> Display(C);[0X
    [4Xa linear [15,4,1..6]6..10 random linear code over GF(3)[0X
  [4X------------------------------------------------------------------[0X
  
  The  method [5XGUAVA[0X chooses to output the result of a [10XRandomLinearCode[0X command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [10XDisplay[0X command to print
  this  information. This new display method was added in version 1.9 to speed
  up  the  command  (if n is about 80 and k about 40, for example, the time it
  took  to look up and/or calculate the bounds on the minimum distance was too
  long).
  
  [1X5.2-13 OptimalityCode[0X
  
  [2X> OptimalityCode( [0X[3XC[0X[2X ) ______________________________________________[0Xfunction
  
  [10XOptimalityCode[0X returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [10XUpperBound[0X  is  not  always  equal to the actual upper bound A(n,d) thus the
  result may not be equal to 0 even if the code is optimal!
  
  [10XOptimalityLinearCode[0X is similar but applies only to linear codes.
  
  [1X5.2-14 BestKnownLinearCode[0X
  
  [2X> BestKnownLinearCode( [0X[3Xn, k, F[0X[2X ) ___________________________________[0Xfunction
  
  [10XBestKnownLinearCode[0X  returns  the best known (as of 11 May 2006) linear code
  of  length  [3Xn[0X,  dimension  [3Xk[0X  over  field  [3XF[0X.  The  function uses the tables
  described in section [2XBoundsMinimumDistance[0X ([14X7.1-13[0X) to construct this code.
  
  This command can also be called using the syntax [10XBestKnownLinearCode( rec )[0X,
  where  [3Xrec[0X must be a record containing the fields `lowerBound', `upperBound'
  and  `construction'.  It  uses  the information in this field to construct a
  code.   This   form   is  meant  to  be  used  together  with  the  function
  [10XBoundsMinimumDistance[0X  (see  [2XBoundsMinimumDistance[0X  ([14X7.1-13[0X)), if the bounds
  are already calculated.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> C1 = BinaryGolayCode();[0X
    [4Xfalse     # it's constructed differently[0X
    [4Xgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0X
    [4Xa linear [23,12,7]3 punctured code[0X
    [4Xgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0X
    [4Xgap> PutStandardForm(G1);[0X
    [4X()[0X
    [4Xgap> Display(G1);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4Xgap> C2 := BinaryGolayCode();[0X
    [4Xa cyclic [23,12,7]3 binary Golay code over GF(2)[0X
    [4Xgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0X
    [4Xgap> PutStandardForm(G2);[0X
    [4X()[0X
    [4Xgap> Display(G2);[0X
    [4X 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0X
    [4X . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0X
    [4X . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0X
    [4X . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0X
    [4X . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0X
    [4X . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0X
    [4X . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0X
    [4X . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0X
    [4X . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0X
    [4X . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0X
    [4X . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0X
    [4X . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0X
    [4X## Despite their generator matrices are different, they are equivalent codes, see below.[0X
    [4Xgap> IsEquivalent(C1,C2);[0X
    [4Xtrue[0X
    [4Xgap> CodeIsomorphism(C1,C2);[0X
    [4X(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0X
    [4Xgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0X
    [4Xa linear [81,77,3]2..3 shortened code of[0X
    [4Xa linear [85,81,3]1 Hamming (4,4) code over GF(4)[0X
    [4Xgap> C:=BestKnownLinearCode(174,72);[0X
    [4Xa linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0X
    [4Xgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0X
    [4Xrec( n := 81, k := 77, q := 4, [0X
    [4X  references := rec( Ham := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0X
    [4X      cap := [ "%T this reference is unknown, for more info", [0X
    [4X          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0X
    [4X  construction := [ (Operation "ShortenedCode"), [0X
    [4X      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0X
    [4X  lowerBound := 3, [0X
    [4X  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0X
    [4X      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0X
    [4X  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0X
    [4X      "Ub(18,14)=3, reference: cap" ] )[0X
    [4Xgap> C := BestKnownLinearCode( bounds );[0X
    [4Xa linear [81,77,3]2..3 shortened code[0X
    [4Xgap> C = BestKnownLinearCode(81, 77, GF(4) );[0X
    [4Xtrue[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.3 Gabidulin Codes[0X
  
  These  five  binary,  linear codes are derived from an article by Gabidulin,
  Davydov  and  Tombak [GDT91]. All these codes are defined by check matrices.
  Exact  definitions  can  be  found  in  the article. The Gabidulin code, the
  enlarged Gabidulin code, the Davydov code, the Tombak code, and the enlarged
  Tombak  code, correspond with theorem 1, 2, 3, 4, and 5, respectively in the
  article.
  
  Like the Hamming codes, these codes have fixed minimum distance and covering
  radius, but can be arbitrarily long.
  
  [1X5.3-1 GabidulinCode[0X
  
  [2X> GabidulinCode( [0X[3Xm, w1, w2[0X[2X ) _______________________________________[0Xfunction
  
  [10XGabidulinCode[0X  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [3Xw1[0X and [3Xw2[0X should be elements of GF(2^m-2).
  
  [1X5.3-2 EnlargedGabidulinCode[0X
  
  [2X> EnlargedGabidulinCode( [0X[3Xm, w1, w2, e[0X[2X ) ____________________________[0Xfunction
  
  [10XEnlargedGabidulinCode[0X  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [3Xw1[0X  and  [3Xw2[0X are elements of
  GF(2^m-2). [3Xe[0X is an element of GF(2^m).
  
  [1X5.3-3 DavydovCode[0X
  
  [2X> DavydovCode( [0X[3Xr, v, ei, ej[0X[2X ) ______________________________________[0Xfunction
  
  [10XDavydovCode[0X  yields  a code of length 2^v + 2^r-v - 3, redundancy [3Xr[0X, minimum
  distance  4 and covering radius 2. [3Xv[0X is an integer between 2 and r-2. [3Xei[0X and
  [3Xej[0X are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1X5.3-4 TombakCode[0X
  
  [2X> TombakCode( [0X[3Xm, e, beta, gamma, w1, w2[0X[2X ) __________________________[0Xfunction
  
  [10XTombakCode[0X  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [3Xe[0X is an element of GF(2^m). [3Xbeta[0X and [3Xgamma[0X
  are elements of GF(2^m-1). [3Xw1[0X and [3Xw2[0X are elements of GF(2^m-3).
  
  [1X5.3-5 EnlargedTombakCode[0X
  
  [2X> EnlargedTombakCode( [0X[3Xm, e, beta, gamma, w1, w2, u[0X[2X ) _______________[0Xfunction
  
  [10XEnlargedTombakCode[0X  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [3Xm[0X, [3Xe[0X, [3Xbeta[0X, [3Xgamma[0X,
  [3Xw1[0X and [3Xw2[0X are defined as in [10XTombakCode[0X. [3Xu[0X is an element of GF(2^m-1).
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0X
    [4Xa linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0X
    [4Xgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0X
    [4Xa linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0X
    [4Xgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0X
    [4Xa linear [57,47,4]2 Tombak code (m=5) over GF(2)[0X
    [4Xgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0X
    [4X> Z(4)^0, Z(4)^0, Z(32)^23 );[0X
    [4Xa linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.4 Golay k code, and thes as in [2XVerticalConversionFieldMat[0X ([14X7.3-9[0X). We use
  this  definition  of  H  to  define  the  code.  The default for [3Xt[0X is 1. The
  original  Srivastava  codes  (see [2XSrivastavaCode[0X ([14X5.2-9[0X)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0X
    [4Xgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0X
    [4Xgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0X
    [4Xa linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-9 SrivastavaCode[0X
  
  [2X> SrivastavaCode( [0X[3Xa, w[, mu], F[0X[2X ) __________________________________[0Xfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [3Xa[0X,  [3Xw[0X  (and
  optionally  [3Xmu[0X).  a  =  a_1, ..., a_n and w = w_1, ..., w_s are lists of n+s
  distinct elements of F=GF(q^m). The default for [3Xmu[0X is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [3Xmu[0X and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [Hel72] for more details on the properties of this
  code.  Related  reference: G. Roelofsen, [12XOn Goppa and Generalized Srivastava
  Codes[0X PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> a := AsSSortedList( GF(11) ){[2..8]};;[0X
    [4Xgap> w := AsSSortedList( GF(11) ){[9..10]};;[0X
    [4Xgap> C := SrivastavaCode( a, w, 2, GF(11) );[0X
    [4Xa linear [7,5,3]2 Srivastava code over GF(11)[0X
    [4Xgap> IsMDSCode( C );[0X
    [4Xtrue    # Always true if F is a prime field [0X
  [4X------------------------------------------------------------------[0X
  
  [1X5.2-10 CordaroWagnerCode[0X
  
  [2X> CordaroWagnerCode( [0X[3Xn[0X[2X ) ___________________________________________[0Xfunction
  
  [10XCordaroWagnerCode[0X  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [3Xn[0X  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [10XRepetitionCode[0X  (see
  [2XRepetitionCode[0X ([14X5.5-13[0X)).
  
  [4X-----------------------