  
  [1m[4m[31m5. Generating Codes[0m
  
  In this chapter we describe functions for generating codes.
  
  Section [1m5.1[0m describes functions for generating unrestricted codes.
  
  Section [1m5.2[0m describes functions for generating linear codes.
  
  Section  [1m5.3[0m  describes  functions  for constructing certain covering codes,
  such as the Gabidulin codes.
  
  Section [1m5.4[0m describes functions for constructing the Golay codes.
  
  Section [1m5.5[0m describes functions for generating cyclic codes.
  
  Section  [1m5.6[0m  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.
  
  
  [1m[4m[31m5.1 Generating Unrestricted Codes[0m
  
  In this section we start with functions that creating code from user defined
  matrices   or  special  matrices  (see  [1m[34mElementsCode[0m  ([1m5.1-1[0m),  [1m[34mHadamardCode[0m
  ([1m5.1-2[0m),  [1m[34mConferenceCode[0m  ([1m5.1-3[0m)  and  [1m[34mMOLSCode[0m  ([1m5.1-4[0m)).  These codes are
  unrestricted codes; they may later be discovered to be linear or cyclic.
  
  The  next  functions  generate random codes (see [1m[34mRandomCode[0m ([1m5.1-5[0m)) and the
  Nordstrom-Robinson code (see [1m[34mNordstromRobinsonCode[0m ([1m5.1-6[0m)), respectively.
  
  Finally,  we  describe  two functions for generating Greedy codes. These are
  codes  that  contructed  by gathering codewords from a space (see [1m[34mGreedyCode[0m
  ([1m5.1-7[0m) and [1m[34mLexiCode[0m ([1m5.1-8[0m)).
  
  [1m[4m[31m5.1-1 ElementsCode[0m
  
  [1m[34m> ElementsCode( [0m[22m[34mL[, name,] F[0m[1m[34m ) _____________________________________[0mfunction
  
  [22m[32mElementsCode[0m  creates an unrestricted code of the list of elements [22m[34mL[0m, in the
  field  [22m[34mF[0m.  [22m[34mL[0m  must  be a list of vectors, strings, polynomials or codewords.
  [22m[34mname[0m can contain a short description of the code.
  
  If  [22m[34mL[0m  contains a codeword more than once, it is removed from the list and a
  [1mGAP[0m set is returned.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> M := Z(3)^0 * [ [1, 0, 1, 1], [2, 2, 0, 0], [0, 1, 2, 2] ];;[0m
    [22m[35mgap> C := ElementsCode( M, "example code", GF(3) );[0m
    [22m[35ma (4,3,1..4)2 example code over GF(3)[0m
    [22m[35mgap> MinimumDistance( C );[0m
    [22m[35m4[0m
    [22m[35mgap> AsSSortedList( C );[0m
    [22m[35m[ [ 0 1 2 2 ], [ 1 0 1 1 ], [ 2 2 0 0 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-2 HadamardCode[0m
  
  [1m[34m> HadamardCode( [0m[22m[34mH[, t][0m[1m[34m ) ___________________________________________[0mfunction
  
  The four forms this command can take are [22m[32mHadamardCode(H,t)[0m, [22m[32mHadamardCode(H)[0m,
  [22m[32mHadamardCode(n,t)[0m, and [22m[32mHadamardCode(n)[0m.
  
  In  the case when the arguments [22m[34mH[0m and [22m[34mt[0m are both given, [22m[32mHadamardCode[0m returns
  a  Hadamard  code of the t^th kind from the Hadamard matrix [22m[34mH[0m In case only [22m[34mH[0m
  is given, t = 3 is used.
  
  By definition, a Hadamard matrix is a square matrix [22m[34mH[0m with H* H^T = -n* I_n,
  where n is the size of [22m[34mH[0m. The entries of [22m[34mH[0m are either 1 or -1.
  
  The  matrix [22m[34mH[0m 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 [22m[36mfirst kind[0m (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 [22m[36msecond kind[0m
  (t=2), by adding all the complements of the already existing codewords. This
  results  in  a  (n-1,  2n,  n/2 -1) code. The [22m[36mthird kind[0m (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  [22m[32mHadamardCode(n,t)[0m  returns a Hadamard code with parameter [22m[34mn[0m of
  the t^th kind. For the command [22m[32mHadamardCode(n)[0m, t=3 is used.
  
  When  called  in  these  forms, [22m[32mHadamardCode[0m first creates a Hadamard matrix
  (see  [1m[34mHadamardMat[0m ([1m7.3-4[0m)), of size [22m[34mn[0m and then follows the same procedure as
  described  above.  Therefore  the same restrictions with respect to [22m[34mn[0m as for
  Hadamard matrices hold.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> H4 := [[1,1,1,1],[1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]];;[0m
    [22m[35mgap> HadamardCode( H4, 1 );[0m
    [22m[35ma (3,4,2)1 Hadamard code of order 4 over GF(2)[0m
    [22m[35mgap> HadamardCode( H4, 2 );[0m
    [22m[35ma (3,8,1)0 Hadamard code of order 4 over GF(2)[0m
    [22m[35mgap> HadamardCode( H4 );[0m
    [22m[35ma (4,8,2)1 Hadamard code of order 4 over GF(2) [0m
    [22m[35mgap> H4 := [[1,1,1,1],[1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]];;[0m
    [22m[35mgap> C := HadamardCode( 4 );[0m
    [22m[35ma (4,8,2)1 Hadamard code of order 4 over GF(2)[0m
    [22m[35mgap> C = HadamardCode( H4 );[0m
    [22m[35mtrue [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-3 ConferenceCode[0m
  
  [1m[34m> ConferenceCode( [0m[22m[34mH[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mConferenceCode[0m  returns  a  code  of length n-1 constructed from a symmetric
  'conference  matrix' [22m[34mH[0m. A [22m[36mconference matrix[0m [22m[34mH[0m 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.
  
  [1mGUAVA[0m 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.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> H6 := [[0,1,1,1,1,1],[1,0,1,-1,-1,1],[1,1,0,1,-1,-1],[0m
    [22m[35m> [1,-1,1,0,1,-1],[1,-1,-1,1,0,1],[1,1,-1,-1,1,0]];;[0m
    [22m[35mgap> C1 := ConferenceCode( H6 );[0m
    [22m[35ma (5,12,2)1..4 conference code over GF(2)[0m
    [22m[35mgap> IsLinearCode( C1 );[0m
    [22m[35mfalse [0m
    [22m[35mgap> C2 := ConferenceCode( 5 );[0m
    [22m[35ma (5,12,2)1..4 conference code over GF(2)[0m
    [22m[35mgap> AsSSortedList( C2 );[0m
    [22m[35m[ [ 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 ], [0m
    [22m[35m  [ 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 ], [0m
    [22m[35m  [ 1 1 1 0 0 ], [ 1 1 1 1 1 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-4 MOLSCode[0m
  
  [1m[34m> MOLSCode( [0m[22m[34m[n,] q[0m[1m[34m ) _______________________________________________[0mfunction
  
  [22m[32mMOLSCode[0m  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 times q. The
  default  for  [22m[34mn[0m  is  4. [1mGUAVA[0m can construct a MOLS code for n-2 <= q. Here [22m[34mq[0m
  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 qtimes 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 [1m[34mIsMDSCode[0m ([1m4.3-7[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := MOLSCode( 6, 5 );[0m
    [22m[35ma (6,25,5)3..4 code generated by 4 MOLS of order 5 over GF(5)[0m
    [22m[35mgap> mols := List( [1 .. WordLength(C1) - 2 ], function( nr )[0m
    [22m[35m>       local ls, el;[0m
    [22m[35m>       ls := NullMat( Size(LeftActingDomain(C1)), Size(LeftActingDomain(C1)) );[0m
    [22m[35m>       for el in VectorCodeword( AsSSortedList( C1 ) ) do[0m
    [22m[35m>          ls[IntFFE(el[1])+1][IntFFE(el[2])+1] := el[nr + 2];[0m
    [22m[35m>       od;[0m
    [22m[35m>       return ls;[0m
    [22m[35m>    end );;[0m
    [22m[35mgap> AreMOLS( mols );[0m
    [22m[35mtrue[0m
    [22m[35mgap> C2 := MOLSCode( 11 );[0m
    [22m[35ma (4,121,3)2 code generated by 2 MOLS of order 11 over GF(11) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-5 RandomCode[0m
  
  [1m[34m> RandomCode( [0m[22m[34mn, M, F[0m[1m[34m ) ____________________________________________[0mfunction
  
  [22m[32mRandomCode[0m  returns  a random unrestricted code of size [22m[34mM[0m with word length [22m[34mn[0m
  over  [22m[34mF[0m. [22m[34mM[0m must be less than or equal to the number of elements in the space
  GF(q)^n.
  
  The   function   [22m[32mRandomLinearCode[0m   returns   a   random  linear  code  (see
  [1m[34mRandomLinearCode[0m ([1m5.2-12[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := RandomCode( 6, 10, GF(8) );[0m
    [22m[35ma (6,10,1..6)4..6 random unrestricted code over GF(8)[0m
    [22m[35mgap> MinimumDistance(C1);[0m
    [22m[35m3[0m
    [22m[35mgap> C2 := RandomCode( 6, 10, GF(8) );[0m
    [22m[35ma (6,10,1..6)4..6 random unrestricted code over GF(8)[0m
    [22m[35mgap> C1 = C2;[0m
    [22m[35mfalse [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-6 NordstromRobinsonCode[0m
  
  [1m[34m> NordstromRobinsonCode( [0m[22m[34m[0m[1m[34m ) ________________________________________[0mfunction
  
  [22m[32mNordstromRobinsonCode[0m  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.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := NordstromRobinsonCode();[0m
    [22m[35ma (16,256,6)4 Nordstrom-Robinson code over GF(2)[0m
    [22m[35mgap> OptimalityCode( C );[0m
    [22m[35m0 [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-7 GreedyCode[0m
  
  [1m[34m> GreedyCode( [0m[22m[34mL, d, F[0m[1m[34m ) ____________________________________________[0mfunction
  
  [22m[32mGreedyCode[0m  returns  a  Greedy  code  with design distance [22m[34md[0m over the finite
  field  [22m[34mF[0m.  The code is constructed using the greedy algorithm on the list of
  vectors  [22m[34mL[0m. (The greedy algorithm checks each vector in [22m[34mL[0m and adds it to the
  code  if  its distance to the current code is greater than or equal to [22m[34md[0m. It
  is obvious that the resulting code has a minimum distance of at least [22m[34md[0m.
  
  Greedy codes are often linear codes.
  
  The  function  [22m[32mLexiCode[0m  creates  a  greedy  code from a basis instead of an
  enumerated list (see [1m[34mLexiCode[0m ([1m5.1-8[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := GreedyCode( Tuples( AsSSortedList( GF(2) ), 5 ), 3, GF(2) );[0m
    [22m[35ma (5,4,3..5)2 Greedy code, user defined basis over GF(2)[0m
    [22m[35mgap> C2 := GreedyCode( Permuted( Tuples( AsSSortedList( GF(2) ), 5 ),[0m
    [22m[35m>                         (1,4) ), 3, GF(2) );[0m
    [22m[35ma (5,4,3..5)2 Greedy code, user defined basis over GF(2)[0m
    [22m[35mgap> C1 = C2;[0m
    [22m[35mfalse [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.1-8 LexiCode[0m
  
  [1m[34m> LexiCode( [0m[22m[34mn, d, F[0m[1m[34m ) ______________________________________________[0mfunction
  
  In  this  format,  [22m[32mLexicode[0m  returns  a  lexicode with word length [22m[34mn[0m, design
  distance [22m[34md[0m over [22m[34mF[0m. The code is constructed using the greedy algorithm on the
  lexicographically ordered list of all vectors of length [22m[34mn[0m over [22m[34mF[0m. Every time
  a  vector is found that has a distance to the current code of at least [22m[34md[0m, it
  is  added  to  the  code.  This  results,  obviously, in a code with minimum
  distance greater than or equal to [22m[34md[0m.
  
  Another syntax which one can use is [22m[32mLexiCode( B, d, F )[0m. When called in this
  format,  [22m[32mLexiCode[0m  uses  the  basis  [22m[34mB[0m instead of the standard basis. [22m[34mB[0m is a
  matrix of vectors over [22m[34mF[0m. The code is constructed using the greedy algorithm
  on  the list of vectors spanned by [22m[34mB[0m, ordered lexicographically with respect
  to [22m[34mB[0m.
  
  Note that binary lexicodes are always linear.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := LexiCode( 4, 3, GF(5) );[0m
    [22m[35ma (4,17,3..4)2..4 lexicode over GF(5) [0m
    [22m[35mgap> B := [ [Z(2)^0, 0*Z(2), 0*Z(2)], [Z(2)^0, Z(2)^0, 0*Z(2)] ];;[0m
    [22m[35mgap> C := LexiCode( B, 2, GF(2) );[0m
    [22m[35ma linear [3,1,2]1..2 lexicode over GF(2) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  The  function  [22m[32mGreedyCode[0m  creates a greedy code that is not restricted to a
  lexicographical order (see [1m[34mGreedyCode[0m ([1m5.1-7[0m)).
  
  
  [1m[4m[31m5.2 Generating Linear Codes[0m
  
  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
  ([1m[34mGeneratorMatCode[0m  ([1m5.2-1[0m))  or  check  matrix  ([1m[34mCheckMatCode[0m  ([1m5.2-3[0m)). All
  linear codes can be constructed with these functions.
  
  The  next functions we describe generate some well-known codes, like Hamming
  codes  ([1m[34mHammingCode[0m ([1m5.2-4[0m)), Reed-Muller codes ([1m[34mReedMullerCode[0m ([1m5.2-5[0m)) and
  the    extended    Golay    codes   ([1m[34mExtendedBinaryGolayCode[0m   ([1m5.4-2[0m)   and
  [1m[34mExtendedTernaryGolayCode[0m ([1m5.4-4[0m)).
  
  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
  [1m[34mAlternantCode[0m  ([1m5.2-6[0m), [1m[34mGoppaCode[0m ([1m5.2-7[0m), [1m[34mGeneralizedSrivastavaCode[0m ([1m5.2-8[0m)
  and [1m[34mSrivastavaCode[0m ([1m5.2-9[0m)).
  
  Finally,  we  describe  a  function  for generating random linear codes (see
  [1m[34mRandomLinearCode[0m ([1m5.2-12[0m)).
  
  [1m[4m[31m5.2-1 GeneratorMatCode[0m
  
  [1m[34m> GeneratorMatCode( [0m[22m[34mG[, name,] F[0m[1m[34m ) _________________________________[0mfunction
  
  [22m[32mGeneratorMatCode[0m  returns a linear code with generator matrix [22m[34mG[0m. [22m[34mG[0m must be a
  matrix  over  finite  field  [22m[34mF[0m.  [22m[34mname[0m 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 [22m[34mG[0m is a k times 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 [1mGAP[0m function [22m[32mBaseMat[0m and results in an
  equal  code.  The  generator  matrix  can  be  retrieved  with  the function
  [22m[32mGeneratorMat[0m (see [1m[34mGeneratorMat[0m ([1m4.7-1[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> G := Z(3)^0 * [[1,0,1,2,0],[0,1,2,1,1],[0,0,1,2,1]];;[0m
    [22m[35mgap> C1 := GeneratorMatCode( G, GF(3) );[0m
    [22m[35ma linear [5,3,1..2]1..2 code defined by generator matrix over GF(3)[0m
    [22m[35mgap> C2 := GeneratorMatCode( IdentityMat( 5, GF(2) ), GF(2) );[0m
    [22m[35ma linear [5,5,1]0 code defined by generator matrix over GF(2)[0m
    [22m[35mgap> GeneratorMatCode( List( AsSSortedList( NordstromRobinsonCode() ),[0m
    [22m[35m> x -> VectorCodeword( x ) ), GF( 2 ) );[0m
    [22m[35ma linear [16,11,1..4]2 code defined by generator matrix over GF(2)[0m
    [22m[35m# This is the smallest linear code that contains the N-R code [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-2 CheckMatCodeMutable[0m
  
  [1m[34m> CheckMatCodeMutable( [0m[22m[34mH[, name,] F[0m[1m[34m ) ______________________________[0mfunction
  
  [22m[32mCheckMatCodeMutable[0m is the same as [22m[32mCheckMatCode[0m except that the check matrix
  and generator matrix are mutable.
  
  [1m[4m[31m5.2-3 CheckMatCode[0m
  
  [1m[34m> CheckMatCode( [0m[22m[34mH[, name,] F[0m[1m[34m ) _____________________________________[0mfunction
  
  [22m[32mCheckMatCode[0m  returns  a linear code with check matrix [22m[34mH[0m. [22m[34mH[0m must be a matrix
  over Galois field [22m[34mF[0m. [22m[34m[name.[0m 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  [22m[34mH[0m  is  a  rtimes  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 [1mGAP[0m function [22m[32mBaseMat[0m. and results in an
  equal  code.  The  check  matrix can be retrieved with the function [22m[32mCheckMat[0m
  (see [1m[34mCheckMat[0m ([1m4.7-2[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> G := Z(3)^0 * [[1,0,1,2,0],[0,1,2,1,1],[0,0,1,2,1]];;[0m
    [22m[35mgap> C1 := CheckMatCode( G, GF(3) );[0m
    [22m[35ma linear [5,2,1..2]2..3 code defined by check matrix over GF(3)[0m
    [22m[35mgap> CheckMat(C1);[0m
    [22m[35m[ [ Z(3)^0, 0*Z(3), Z(3)^0, Z(3), 0*Z(3) ],[0m
    [22m[35m  [ 0*Z(3), Z(3)^0, Z(3), Z(3)^0, Z(3)^0 ],[0m
    [22m[35m  [ 0*Z(3), 0*Z(3), Z(3)^0, Z(3), Z(3)^0 ] ][0m
    [22m[35mgap> C2 := CheckMatCode( IdentityMat( 5, GF(2) ), GF(2) );[0m
    [22m[35ma cyclic [5,0,5]5 code defined by check matrix over GF(2)[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-4 HammingCode[0m
  
  [1m[34m> HammingCode( [0m[22m[34mr, F[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mHammingCode[0m  returns a Hamming code with redundancy [22m[34mr[0m over [22m[34mF[0m. A Hamming code
  is a single-error-correcting code. The parity check matrix of a Hamming code
  has  all  nonzero  vectors  of  length  [22m[34mr[0m  in  its  columns,  except  for  a
  multiplication  factor.  The  decoding  algorithm  of  the Hamming code (see
  [1m[34mDecode[0m ([1m4.10-1[0m)) makes use of this property.
  
  If  q  is  the  size  of  its field [22m[34mF[0m, the returned Hamming code is a linear
  [(q^r-1)/(q-1), (q^r-1)/(q-1) - r, 3] code.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := HammingCode( 4, GF(2) );[0m
    [22m[35ma linear [15,11,3]1 Hamming (4,2) code over GF(2)[0m
    [22m[35mgap> C2 := HammingCode( 3, GF(9) );[0m
    [22m[35ma linear [91,88,3]1 Hamming (3,9) code over GF(9) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-5 ReedMullerCode[0m
  
  [1m[34m> ReedMullerCode( [0m[22m[34mr, k[0m[1m[34m ) ___________________________________________[0mfunction
  
  [22m[32mReedMullerCode[0m  returns a binary 'Reed-Muller code' [22m[34mR(r, k)[0m with dimension [22m[34mk[0m
  and  order [22m[34mr[0m. 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.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> ReedMullerCode( 1, 3 );[0m
    [22m[35ma linear [8,4,4]2 Reed-Muller (1,3) code over GF(2) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  See  [1m[34mGeneralizedReedMuller[0m  ([1m???GeneralizedReedMuller???[0m) for a more general
  construction.
  
  [1m[4m[31m5.2-6 AlternantCode[0m
  
  [1m[34m> AlternantCode( [0m[22m[34mr, Y[, alpha,] F[0m[1m[34m ) ________________________________[0mfunction
  
  [22m[32mAlternantCode[0m  returns  an  'alternant code', with parameters [22m[34mr[0m, [22m[34mY[0m and [22m[34malpha[0m
  (optional).  [22m[34mF[0m  denotes  the  (finite)  base  field.  Here,  [22m[34mr[0m is the design
  redundancy  of the code. [22m[34mY[0m and [22m[34malpha[0m are both vectors of length [22m[34mn[0m 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
  [1m[34mVerticalConversionFieldMat[0m  ([1m7.3-9[0m)).  If  no [22m[34malpha[0m is specified, the vector
  [1,  a,  a^2, .., a^n-1] is used, where a is a primitive element of a Galois
  field [22m[34mF[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> Y := [ 1, 1, 1, 1, 1, 1, 1];; a := PrimitiveUnityRoot( 2, 7 );;[0m
    [22m[35mgap> alpha := List( [0..6], i -> a^i );;[0m
    [22m[35mgap> C := AlternantCode( 2, Y, alpha, GF(8) );[0m
    [22m[35ma linear [7,3,3..4]3..4 alternant code over GF(8) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-7 GoppaCode[0m
  
  [1m[34m> GoppaCode( [0m[22m[34mG, L[0m[1m[34m ) ________________________________________________[0mfunction
  
  [22m[32mGoppaCode[0m   returns   a  Goppa  code  [22m[34mC[0m  from  Goppa  polynomial  [22m[34mg[0m,  having
  coefficients in a Galois Field GF(q). [22m[34mL[0m must be a list of elements in GF(q),
  that  are not roots of [22m[34mg[0m. The word length of the code is equal to the length
  of  [22m[34mL[0m.  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
  [1m[34mVerticalConversionFieldMat[0m  ([1m7.3-9[0m), 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  [22m[32mGoppaCode[0m using the syntax [22m[32mGoppaCode(g,n)[0m. When called
  with  parameter  [22m[34mn[0m,  [1mGUAVA[0m  constructs  a  list  L of length [22m[34mn[0m, such that no
  element of [22m[34mL[0m is a root of [22m[34mg[0m.
  
  This is a special case of an alternant code.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> x:=Indeterminate(GF(8),"x");[0m
    [22m[35mx[0m
    [22m[35mgap> L:=Elements(GF(8));[0m
    [22m[35m[ 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 ][0m
    [22m[35mgap> g:=x^2+x+1;[0m
    [22m[35mx^2+x+Z(2)^0[0m
    [22m[35mgap> C:=GoppaCode(g,L);[0m
    [22m[35ma linear [8,2,5]3 Goppa code over GF(2)[0m
    [22m[35mgap> xx := Indeterminate( GF(2), "xx" );; [0m
    [22m[35mgap> gg := xx^2 + xx + 1;; L := AsSSortedList( GF(8) );;[0m
    [22m[35mgap> C1 := GoppaCode( gg, L );[0m
    [22m[35ma linear [8,2,5]3 Goppa code over GF(2) [0m
    [22m[35mgap> y := Indeterminate( GF(2), "y" );; [0m
    [22m[35mgap> h := y^2 + y + 1;;[0m
    [22m[35mgap> C2 := GoppaCode( h, 8 );[0m
    [22m[35ma linear [8,2,5]3 Goppa code over GF(2) [0m
    [22m[35mgap> C1=C2;[0m
    [22m[35mtrue[0m
    [22m[35mgap> C=C1;[0m
    [22m[35mtrue[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-8 GeneralizedSrivastavaCode[0m
  
  [1m[34m> GeneralizedSrivastavaCode( [0m[22m[34ma, w, z[, t,] F[0m[1m[34m ) _____________________[0mfunction
  
  [22m[32mGeneralizedSrivastavaCode[0m   returns   a  generalized  Srivastava  code  with
  parameters  [22m[34ma[0m, [22m[34mw[0m, [22m[34mz[0m, [22m[34mt[0m. 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 [22m[34mt[0m 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 [1m[34mVerticalConversionFieldMat[0m ([1m7.3-9[0m). We use
  this  definition  of  H  to  define  the  code.  The default for [22m[34mt[0m is 1. The
  original  Srivastava  codes  (see [1m[34mSrivastavaCode[0m ([1m5.2-9[0m)) are a special case
  t=1, z_i=a_i^mu, for some mu.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> a := Filtered( AsSSortedList( GF(2^6) ), e -> e in GF(2^3) );;[0m
    [22m[35mgap> w := [ Z(2^6) ];; z := List( [1..8], e -> 1 );;[0m
    [22m[35mgap> C := GeneralizedSrivastavaCode( a, w, z, 1, GF(64) );[0m
    [22m[35ma linear [8,2,2..5]3..4 generalized Srivastava code over GF(2) [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-9 SrivastavaCode[0m
  
  [1m[34m> SrivastavaCode( [0m[22m[34ma, w[, mu,] F[0m[1m[34m ) __________________________________[0mfunction
  
  SrivastavaCode   returns  a  Srivastava  code  with  parameters  [22m[34ma[0m,  [22m[34mw[0m  (and
  optionally  [22m[34mmu[0m).  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 [22m[34mmu[0m is 1. The Srivastava code
  is a generalized Srivastava code, in which z_i = a_i^mu for some [22m[34mmu[0m and t=1.
  
  J.  N.  Srivastava  introduced  this  code  in 1967, though his work was not
  published.  See  Helgert  [H72]  for  more details on the properties of this
  code.  Related  reference: G. Roelofsen, [1m[46mOn Goppa and Generalized Srivastava
  Codes[0m PhD thesis, Dept. Math. and Comp. Sci., Eindhoven Univ. of Technology,
  the Netherlands, 1982.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> a := AsSSortedList( GF(11) ){[2..8]};;[0m
    [22m[35mgap> w := AsSSortedList( GF(11) ){[9..10]};;[0m
    [22m[35mgap> C := SrivastavaCode( a, w, 2, GF(11) );[0m
    [22m[35ma linear [7,5,3]2 Srivastava code over GF(11)[0m
    [22m[35mgap> IsMDSCode( C );[0m
    [22m[35mtrue    # Always true if F is a prime field [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-10 CordaroWagnerCode[0m
  
  [1m[34m> CordaroWagnerCode( [0m[22m[34mn[0m[1m[34m ) ___________________________________________[0mfunction
  
  [22m[32mCordaroWagnerCode[0m  returns  a  binary Cordaro-Wagner code. This is a code of
  length  [22m[34mn[0m  and dimension 2 having the best possible minimum distance d. This
  code   is   just   a  little  bit  less  trivial  than  [22m[32mRepetitionCode[0m  (see
  [1m[34mRepetitionCode[0m ([1m5.5-12[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := CordaroWagnerCode( 11 );[0m
    [22m[35ma linear [11,2,7]5 Cordaro-Wagner code over GF(2)[0m
    [22m[35mgap> AsSSortedList(C);                 [0m
    [22m[35m[ [ 0 0 0 0 0 0 0 0 0 0 0 ], [ 0 0 0 0 1 1 1 1 1 1 1 ], [0m
    [22m[35m  [ 1 1 1 1 0 0 0 1 1 1 1 ], [ 1 1 1 1 1 1 1 0 0 0 0 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-11 FerreroDesignCode[0m
  
  [1m[34m> FerreroDesignCode( [0m[22m[34mP, m[0m[1m[34m ) ________________________________________[0mfunction
  
  [22m[36mRequires the GAP package SONATA[0m
  
  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.
  
  [22m[32mFerreroDesignCode[0m  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 [22m[32mFpfAutomorphismGroupsCyclic[0m).
  
  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
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> G:=AbelianGroup([5,5] );[0m
    [22m[35m [ pc group of size 25 with 2 generators ][0m
    [22m[35mgap> FpfAutomorphismGroupsMaxSize( G );[0m
    [22m[35m[ 24, 2 ][0m
    [22m[35mgap> L:=FpfAutomorphismGroupsCyclic( [5,5], 3 );[0m
    [22m[35m[ [ [ f1, f2 ] -> [ f1*f2^2, f1*f2^3 ] ],[0m
    [22m[35m  [ pc group of size 25 with 2 generators ] ][0m
    [22m[35mgap> D := DesignFromFerreroPair( L[2], Group(L[1][1]), "*" );[0m
    [22m[35m [ a 2 - ( 25, 3, 2 ) nearring generated design ][0m
    [22m[35mgap> M:=IncidenceMat( D );; Length(M); Length(TransposedMat(M));[0m
    [22m[35m25[0m
    [22m[35m200[0m
    [22m[35mgap> C1:=GeneratorMatCode(M*Z(2),GF(2));[0m
    [22m[35ma linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0m
    [22m[35mgap> MinimumDistance(C1);[0m
    [22m[35m24[0m
    [22m[35mgap> C2:=FerreroDesignCode( [5,5],3);[0m
    [22m[35ma linear [200,25,1..24]62..100 code defined by generator matrix over GF(2)[0m
    [22m[35mgap> C1=C2;[0m
    [22m[35mtrue[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.2-12 RandomLinearCode[0m
  
  [1m[34m> RandomLinearCode( [0m[22m[34mn, k, F[0m[1m[34m ) ______________________________________[0mfunction
  
  [22m[32mRandomLinearCode[0m  returns a random linear code with word length [22m[34mn[0m, dimension
  [22m[34mk[0m  over  field [22m[34mF[0m. The method used is to first construct a ktimes n matrix of
  the  block  form  (I,A),  where  I  is a ktimes k identity matrix and A is a
  ktimes (n-k) matrix constructed using [22m[32mRandom(F)[0m repeatedly. Then the columns
  are permuted using a randomly selected element of [22m[32mSymmetricGroup(n)[0m.
  
  To  create  a  random  unrestricted  code,  use  [22m[32mRandomCode[0m  (see [1m[34mRandomCode[0m
  ([1m5.1-5[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := RandomLinearCode( 15, 4, GF(3) );[0m
    [22m[35ma  [15,4,?] randomly generated code over GF(3)[0m
    [22m[35mgap> Display(C);[0m
    [22m[35ma linear [15,4,1..6]6..10 random linear code over GF(3)[0m
  [22m[35m------------------------------------------------------------------[0m
  
  The  method [1mGUAVA[0m chooses to output the result of a [22m[32mRandomLinearCode[0m command
  is  different  than  other  codes.  For  example,  the bounds on the minimum
  distance  is not displayed. Howeer, you can use the [22m[32mDisplay[0m 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).
  
  [1m[4m[31m5.2-13 OptimalityCode[0m
  
  [1m[34m> OptimalityCode( [0m[22m[34mC[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mOptimalityCode[0m returns the difference between the smallest known upper bound
  and  the  actual  size  of  the  code.  Note  that the value of the function
  [22m[32mUpperBound[0m  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!
  
  [22m[32mOptimalityLinearCode[0m is similar but applies only to linear codes.
  
  [1m[4m[31m5.2-14 BestKnownLinearCode[0m
  
  [1m[34m> BestKnownLinearCode( [0m[22m[34mn, k, F[0m[1m[34m ) ___________________________________[0mfunction
  
  [22m[32mBestKnownLinearCode[0m  returns  the best known (as of 11 May 2006) linear code
  of  length  [22m[34mn[0m,  dimension  [22m[34mk[0m  over  field  [22m[34mF[0m.  The  function uses the tables
  described in section [1m[34mBoundsMinimumDistance[0m ([1m7.1-13[0m) to construct this code.
  
  This command can also be called using the syntax [22m[32mBestKnownLinearCode( rec )[0m,
  where  [22m[34mrec[0m 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
  [22m[32mBoundsMinimumDistance[0m  (see  [1m[34mBoundsMinimumDistance[0m  ([1m7.1-13[0m)), if the bounds
  are already calculated.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0m
    [22m[35ma linear [23,12,7]3 punctured code[0m
    [22m[35mgap> C1 = BinaryGolayCode();[0m
    [22m[35mfalse     # it's constructed differently[0m
    [22m[35mgap> C1 := BestKnownLinearCode( 23, 12, GF(2) );[0m
    [22m[35ma linear [23,12,7]3 punctured code[0m
    [22m[35mgap> G1 := MutableCopyMat(GeneratorMat(C1));;[0m
    [22m[35mgap> PutStandardForm(G1);[0m
    [22m[35m()[0m
    [22m[35mgap> Display(G1);[0m
    [22m[35m 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0m
    [22m[35m . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . .[0m
    [22m[35m . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0m
    [22m[35m . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 .[0m
    [22m[35m . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . 1[0m
    [22m[35m . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 1[0m
    [22m[35m . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0m
    [22m[35m . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0m
    [22m[35m . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0m
    [22m[35m . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 .[0m
    [22m[35m . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 1[0m
    [22m[35m . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0m
    [22m[35mgap> C2 := BinaryGolayCode();[0m
    [22m[35ma cyclic [23,12,7]3 binary Golay code over GF(2)[0m
    [22m[35mgap> G2 := MutableCopyMat(GeneratorMat(C2));;[0m
    [22m[35mgap> PutStandardForm(G2);[0m
    [22m[35m()[0m
    [22m[35mgap> Display(G2);[0m
    [22m[35m 1 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1[0m
    [22m[35m . 1 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1[0m
    [22m[35m . . 1 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1[0m
    [22m[35m . . . 1 . . . . . . . . 1 1 . . . 1 1 1 . 1 1[0m
    [22m[35m . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 . .[0m
    [22m[35m . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1 .[0m
    [22m[35m . . . . . . 1 . . . . . . . 1 1 . . 1 1 . 1 1[0m
    [22m[35m . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 . .[0m
    [22m[35m . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1 .[0m
    [22m[35m . . . . . . . . . 1 . . . . 1 . 1 1 . 1 1 1 1[0m
    [22m[35m . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1 .[0m
    [22m[35m . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1[0m
    [22m[35m## Despite their generator matrices are different, they are equivalent codes, see below.[0m
    [22m[35mgap> IsEquivalent(C1,C2);[0m
    [22m[35mtrue[0m
    [22m[35mgap> CodeIsomorphism(C1,C2);[0m
    [22m[35m(4,14,6,12,5)(7,17,18,11,19)(8,22,13,21,16)(10,23,15,20)[0m
    [22m[35mgap> Display( BestKnownLinearCode( 81, 77, GF(4) ) );[0m
    [22m[35ma linear [81,77,3]2..3 shortened code of[0m
    [22m[35ma linear [85,81,3]1 Hamming (4,4) code over GF(4)[0m
    [22m[35mgap> C:=BestKnownLinearCode(174,72);[0m
    [22m[35ma linear [174,72,31..36]26..87 code defined by generator matrix over GF(2)[0m
    [22m[35mgap> bounds := BoundsMinimumDistance( 81, 77, GF(4) );[0m
    [22m[35mrec( n := 81, k := 77, q := 4, [0m
    [22m[35m  references := rec( Ham := [ "%T this reference is unknown, for more info", [0m
    [22m[35m          "%T contact A.E. Brouwer (aeb@cwi.nl)" ], [0m
    [22m[35m      cap := [ "%T this reference is unknown, for more info", [0m
    [22m[35m          "%T contact A.E. Brouwer (aeb@cwi.nl)" ] ), [0m
    [22m[35m  construction := [ (Operation "ShortenedCode"), [0m
    [22m[35m      [ [ (Operation "HammingCode"), [ 4, 4 ] ], [ 1, 2, 3, 4 ] ] ], [0m
    [22m[35m  lowerBound := 3, [0m
    [22m[35m  lowerBoundExplanation := [ "Lb(81,77)=3, by shortening of:", [0m
    [22m[35m      "Lb(85,81)=3, reference: Ham" ], upperBound := 3, [0m
    [22m[35m  upperBoundExplanation := [ "Ub(81,77)=3, by considering shortening to:", [0m
    [22m[35m      "Ub(18,14)=3, reference: cap" ] )[0m
    [22m[35mgap> C := BestKnownLinearCode( bounds );[0m
    [22m[35ma linear [81,77,3]2..3 shortened code[0m
    [22m[35mgap> C = BestKnownLinearCode(81, 77, GF(4) );[0m
    [22m[35mtrue[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m5.3 Gabidulin Codes[0m
  
  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.
  
  [1m[4m[31m5.3-1 GabidulinCode[0m
  
  [1m[34m> GabidulinCode( [0m[22m[34mm, w1, w2[0m[1m[34m ) _______________________________________[0mfunction
  
  [22m[32mGabidulinCode[0m  yields a code of length 5 . 2^m-2-1, redundancy 2m-1, minimum
  distance 3 and covering radius 2. [22m[34mw1[0m and [22m[34mw2[0m should be elements of GF(2^m-2).
  
  [1m[4m[31m5.3-2 EnlargedGabidulinCode[0m
  
  [1m[34m> EnlargedGabidulinCode( [0m[22m[34mm, w1, w2, e[0m[1m[34m ) ____________________________[0mfunction
  
  [22m[32mEnlargedGabidulinCode[0m  yields  a  code  of length 7. 2^m-2-2, redundancy 2m,
  minimum  distance  3  and  covering  radius  2.  [22m[34mw1[0m  and  [22m[34mw2[0m are elements of
  GF(2^m-2). [22m[34me[0m is an element of GF(2^m).
  
  [1m[4m[31m5.3-3 DavydovCode[0m
  
  [1m[34m> DavydovCode( [0m[22m[34mr, v, ei, ej[0m[1m[34m ) ______________________________________[0mfunction
  
  [22m[32mDavydovCode[0m  yields  a code of length 2^v + 2^r-v - 3, redundancy [22m[34mr[0m, minimum
  distance  4 and covering radius 2. [22m[34mv[0m is an integer between 2 and r-2. [22m[34mei[0m and
  [22m[34mej[0m are elements of GF(2^v) and GF(2^r-v), respectively.
  
  [1m[4m[31m5.3-4 TombakCode[0m
  
  [1m[34m> TombakCode( [0m[22m[34mm, e, beta, gamma, w1, w2[0m[1m[34m ) __________________________[0mfunction
  
  [22m[32mTombakCode[0m  yields  a  code of length 15 * 2^m-3 - 3, redundancy 2m, minimum
  distance 4 and covering radius 2. [22m[34me[0m is an element of GF(2^m). [22m[34mbeta[0m and [22m[34mgamma[0m
  are elements of GF(2^m-1). [22m[34mw1[0m and [22m[34mw2[0m are elements of GF(2^m-3).
  
  [1m[4m[31m5.3-5 EnlargedTombakCode[0m
  
  [1m[34m> EnlargedTombakCode( [0m[22m[34mm, e, beta, gamma, w1, w2, u[0m[1m[34m ) _______________[0mfunction
  
  [22m[32mEnlargedTombakCode[0m  yields a code of length 23 * 2^m-4 - 3, redundancy 2m-1,
  minimum  distance 4 and covering radius 2. The parameters [22m[34mm[0m, [22m[34me[0m, [22m[34mbeta[0m, [22m[34mgamma[0m,
  [22m[34mw1[0m and [22m[34mw2[0m are defined as in [22m[32mTombakCode[0m. [22m[34mu[0m is an element of GF(2^m-1).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> GabidulinCode( 4, Z(4)^0, Z(4)^1 );[0m
    [22m[35ma linear [19,12,3]2 Gabidulin code (m=4) over GF(2)[0m
    [22m[35mgap> EnlargedGabidulinCode( 4, Z(4)^0, Z(4)^1, Z(16)^11 );[0m
    [22m[35ma linear [26,18,3]2 enlarged Gabidulin code (m=4) over GF(2)[0m
    [22m[35mgap> DavydovCode( 6, 3, Z(8)^1, Z(8)^5 );[0m
    [22m[35ma linear [13,7,4]2 Davydov code (r=6, v=3) over GF(2)[0m
    [22m[35mgap> TombakCode( 5, Z(32)^6, Z(16)^14, Z(16)^10, Z(4)^0, Z(4)^1 );[0m
    [22m[35ma linear [57,47,4]2 Tombak code (m=5) over GF(2)[0m
    [22m[35mgap> EnlargedTombakCode( 6, Z(32)^6, Z(16)^14, Z(16)^10,[0m
    [22m[35m> Z(4)^0, Z(4)^0, Z(32)^23 );[0m
    [22m[35ma linear [89,78,4]2 enlarged Tombak code (m=6) over GF(2)[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m5.4 Golay Codes[0m
  
  "  The  Golay  code  is  probably  the  most important of all codes for both
  practical  and  theoretical  reasons.  "  ([MS83],  pg.  64). Though born in
  Switzerland, M. J. E. Golay (1902-1989) worked for the US Army Labs for most
  of  his  career.  For more information on his life, see his obit in the June
  1990 IEEE Information Society Newsletter.
  
  [1m[4m[31m5.4-1 BinaryGolayCode[0m
  
  [1m[34m> BinaryGolayCode( [0m[22m[34m[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mBinaryGolayCode[0m  returns  a  binary  Golay code. This is a perfect [23,12,7]
  code.    It    is    also    cyclic,    and    has    generator   polynomial
  g(x)=1+x^2+x^4+x^5+x^6+x^10+x^11.  Extending it results in an extended Golay
  code  (see  [1m[34mExtendedBinaryGolayCode[0m ([1m5.4-2[0m)). There's also the ternary Golay
  code (see [1m[34mTernaryGolayCode[0m ([1m5.4-3[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C:=BinaryGolayCode();[0m
    [22m[35ma cyclic [23,12,7]3 binary Golay code over GF(2)[0m
    [22m[35mgap> ExtendedBinaryGolayCode() = ExtendedCode(BinaryGolayCode());[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsPerfectCode(C);[0m
    [22m[35mtrue [0m
    [22m[35mgap> IsCyclicCode(C);[0m
    [22m[35mtrue[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.4-2 ExtendedBinaryGolayCode[0m
  
  [1m[34m> ExtendedBinaryGolayCode( [0m[22m[34m[0m[1m[34m ) ______________________________________[0mfunction
  
  [22m[32mExtendedBinaryGolayCode[0m  returns  an  extended  binary Golay code. This is a
  [24,12,8]  code. Puncturing in the last position results in a perfect binary
  Golay code (see [1m[34mBinaryGolayCode[0m ([1m5.4-1[0m)). The code is self-dual.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := ExtendedBinaryGolayCode();[0m
    [22m[35ma linear [24,12,8]4 extended binary Golay code over GF(2)[0m
    [22m[35mgap> IsSelfDualCode(C);[0m
    [22m[35mtrue[0m
    [22m[35mgap> P := PuncturedCode(C);[0m
    [22m[35ma linear [23,12,7]3 punctured code[0m
    [22m[35mgap> P = BinaryGolayCode();[0m
    [22m[35mtrue [0m
    [22m[35mgap> IsCyclicCode(C);[0m
    [22m[35mfalse[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.4-3 TernaryGolayCode[0m
  
  [1m[34m> TernaryGolayCode( [0m[22m[34m[0m[1m[34m ) _____________________________________________[0mfunction
  
  [22m[32mTernaryGolayCode[0m  returns  a  ternary Golay code. This is a perfect [11,6,5]
  code.    It    is    also    cyclic,    and    has    generator   polynomial
  g(x)=2+x^2+2x^3+x^4+x^5. Extending it results in an extended Golay code (see
  [1m[34mExtendedTernaryGolayCode[0m  ([1m5.4-4[0m)).  There's also the binary Golay code (see
  [1m[34mBinaryGolayCode[0m ([1m5.4-1[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C:=TernaryGolayCode();[0m
    [22m[35ma cyclic [11,6,5]2 ternary Golay code over GF(3)[0m
    [22m[35mgap> ExtendedTernaryGolayCode() = ExtendedCode(TernaryGolayCode());[0m
    [22m[35mtrue [0m
    [22m[35mgap> IsCyclicCode(C);[0m
    [22m[35mtrue[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.4-4 ExtendedTernaryGolayCode[0m
  
  [1m[34m> ExtendedTernaryGolayCode( [0m[22m[34m[0m[1m[34m ) _____________________________________[0mfunction
  
  [22m[32mExtendedTernaryGolayCode[0m  returns  an extended ternary Golay code. This is a
  [12,6,6]  code. Puncturing this code results in a perfect ternary Golay code
  (see [1m[34mTernaryGolayCode[0m ([1m5.4-3[0m)). The code is self-dual.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := ExtendedTernaryGolayCode();[0m
    [22m[35ma linear [12,6,6]3 extended ternary Golay code over GF(3)[0m
    [22m[35mgap> IsSelfDualCode(C);[0m
    [22m[35mtrue[0m
    [22m[35mgap> P := PuncturedCode(C);[0m
    [22m[35ma linear [11,6,5]2 punctured code[0m
    [22m[35mgap> P = TernaryGolayCode();[0m
    [22m[35mtrue [0m
    [22m[35mgap> IsCyclicCode(C);[0m
    [22m[35mfalse[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m5.5 Generating Cyclic Codes[0m
  
  The  elements  of  a  cyclic  code  C  are  all multiples of a ('generator')
  polynomial g(x), where calculations are carried out modulo x^n-1. Therefore,
  as  polynomials  in x, the elements always have degree less than n. A cyclic
  code is an ideal in the ring F[x]/(x^n-1) of polynomials modulo x^n - 1. The
  unique  monic  polynomial  of  least  degree  that generates C is called the
  [22m[36mgenerator polynomial[0m of C. It is a divisor of the polynomial x^n-1.
  
  The  [22m[36mcheck  polynomial[0m is the polynomial h(x) with g(x)h(x)=x^n-1. Therefore
  it is also a divisor of x^n-1. The check polynomial has the property that
  
  \[
       c(x)h(x) \equiv 0 \pmod{x^n-1},
  \]
  
  for every codeword c(x)in C.
  
  The  first  two functions described below generate cyclic codes from a given
  generator  or  check  polynomial.  All cyclic codes can be constructed using
  these functions.
  
  Two  of  the  Golay  codes already described are cyclic (see [1m[34mBinaryGolayCode[0m
  ([1m5.4-1[0m)  and  [1m[34mTernaryGolayCode[0m ([1m5.4-3[0m)). For example, the [1mGUAVA[0m record for a
  binary Golay code contains the generator polynomial:
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := BinaryGolayCode();[0m
    [22m[35ma cyclic [23,12,7]3 binary Golay code over GF(2)[0m
    [22m[35mgap> NamesOfComponents(C);[0m
    [22m[35m[ "LeftActingDomain", "GeneratorsOfLeftOperatorAdditiveGroup", "WordLength",[0m
    [22m[35m  "GeneratorMat", "GeneratorPol", "Dimension", "Redundancy", "Size", "name",[0m
    [22m[35m  "lowerBoundMinimumDistance", "upperBoundMinimumDistance", "WeightDistribution",[0m
    [22m[35m  "boundsCoveringRadius", "MinimumWeightOfGenerators", [0m
    [22m[35m  "UpperBoundOptimalMinimumDistance" ][0m
    [22m[35mgap> C!.GeneratorPol;[0m
    [22m[35mx_1^11+x_1^10+x_1^6+x_1^5+x_1^4+x_1^2+Z(2)^0[0m
  [22m[35m------------------------------------------------------------------[0m
  
  Then  functions that generate cyclic codes from a prescribed set of roots of
  the  generator  polynomial  are  described,  including  the  BCH  codes (see
  [1m[34mRootsCode[0m  ([1m5.5-3[0m),  [1m[34mBCHCode[0m  ([1m5.5-4[0m),  [1m[34mReedSolomonCode[0m  ([1m5.5-5[0m)  and [1m[34mQRCode[0m
  ([1m5.5-6[0m)).
  
  Finally we describe the trivial codes (see [1m[34mWholeSpaceCode[0m ([1m5.5-10[0m), [1m[34mNullCode[0m
  ([1m5.5-11[0m),  [1m[34mRepetitionCode[0m ([1m5.5-12[0m)), and the command [22m[32mCyclicCodes[0m which lists
  all cyclic codes ([1m[34mCyclicCodes[0m ([1m5.5-13[0m)).
  
  [1m[4m[31m5.5-1 GeneratorPolCode[0m
  
  [1m[34m> GeneratorPolCode( [0m[22m[34mg, n[, name,] F[0m[1m[34m ) ______________________________[0mfunction
  
  [22m[32mGeneratorPolCode[0m  creates  a cyclic code with a generator polynomial [22m[34mg[0m, word
  length [22m[34mn[0m, over [22m[34mF[0m. [22m[34mname[0m can contain a short description of the code.
  
  If [22m[34mg[0m is not a divisor of x^n-1, it cannot be a generator polynomial. In that
  case,  a code is created with generator polynomial gcd( g, x^n-1 ), i.e. the
  greatest common divisor of [22m[34mg[0m and x^n-1. This is a valid generator polynomial
  that generates the ideal (g). See [1m[34mGenerating Cyclic Codes[0m ([1m5.5[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> x:= Indeterminate( GF(2) );; P:= x^2+1;[0m
    [22m[35mZ(2)^0+x^2[0m
    [22m[35mgap> C1 := GeneratorPolCode(P, 7, GF(2));[0m
    [22m[35ma cyclic [7,6,1..2]1 code defined by generator polynomial over GF(2)[0m
    [22m[35mgap> GeneratorPol( C1 );[0m
    [22m[35mZ(2)^0+x[0m
    [22m[35mgap> C2 := GeneratorPolCode( x+1, 7, GF(2)); [0m
    [22m[35ma cyclic [7,6,1..2]1 code defined by generator polynomial over GF(2)[0m
    [22m[35mgap> GeneratorPol( C2 );[0m
    [22m[35mZ(2)^0+x[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-2 CheckPolCode[0m
  
  [1m[34m> CheckPolCode( [0m[22m[34mh, n[, name,] F[0m[1m[34m ) __________________________________[0mfunction
  
  [22m[32mCheckPolCode[0m creates a cyclic code with a check polynomial [22m[34mh[0m, word length [22m[34mn[0m,
  over [22m[34mF[0m. [22m[34mname[0m can contain a short description of the code (as a string).
  
  If  [22m[34mh[0m  is  not  a divisor of x^n-1, it cannot be a check polynomial. In that
  case,  a  code  is  created  with check polynomial gcd( h, x^n-1 ), i.e. the
  greatest  common  divisor  of  [22m[34mh[0m and x^n-1. This is a valid check polynomial
  that yields the same elements as the ideal (h). See [1m5.5[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap>  x:= Indeterminate( GF(3) );; P:= x^2+2;[0m
    [22m[35m-Z(3)^0+x_1^2[0m
    [22m[35mgap> H := CheckPolCode(P, 7, GF(3));[0m
    [22m[35ma cyclic [7,1,7]4 code defined by check polynomial over GF(3)[0m
    [22m[35mgap> CheckPol(H);[0m
    [22m[35m-Z(3)^0+x_1[0m
    [22m[35mgap> Gcd(P, X(GF(3))^7-1);[0m
    [22m[35m-Z(3)^0+x_1[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-3 RootsCode[0m
  
  [1m[34m> RootsCode( [0m[22m[34mn, list[0m[1m[34m ) _____________________________________________[0mfunction
  
  This  is  the  generalization of the BCH, Reed-Solomon and quadratic residue
  codes (see [1m[34mBCHCode[0m ([1m5.5-4[0m), [1m[34mReedSolomonCode[0m ([1m5.5-5[0m) and [1m[34mQRCode[0m ([1m5.5-6[0m)). The
  user  can  give  a  length  of the code [22m[34mn[0m and a prescribed set of zeros. The
  argument  [22m[34mlist[0m  must  be  a valid list of primitive n^th roots of unity in a
  splitting  field  GF(q^m).  The resulting code will be over the field GF(q).
  The function will return the largest possible cyclic code for which the list
  [22m[34mlist[0m  is a subset of the roots of the code. From this list, [1mGUAVA[0m calculates
  the entire set of roots.
  
  This  command can also be called with the syntax [22m[32mRootsCode( n, list, q )[0m. In
  this  second form, the second argument is a list of integers, ranging from 0
  to  n-1.  The  resulting code will be over a field GF(q). [1mGUAVA[0m calculates a
  primitive  n^th  root  of  unity, alpha, in the extension field of GF(q). It
  uses  the  set  of  the  powers  of alpha in the list as a prescribed set of
  zeros.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> a := PrimitiveUnityRoot( 3, 14 );[0m
    [22m[35mZ(3^6)^52[0m
    [22m[35mgap> C1 := RootsCode( 14, [ a^0, a, a^3 ] );[0m
    [22m[35ma cyclic [14,7,3..6]3..7 code defined by roots over GF(3)[0m
    [22m[35mgap> MinimumDistance( C1 );[0m
    [22m[35m4[0m
    [22m[35mgap> b := PrimitiveUnityRoot( 2, 15 );[0m
    [22m[35mZ(2^4)[0m
    [22m[35mgap> C2 := RootsCode( 15, [ b, b^2, b^3, b^4 ] );[0m
    [22m[35ma cyclic [15,7,5]3..5 code defined by roots over GF(2)[0m
    [22m[35mgap> C2 = BCHCode( 15, 5, GF(2) );[0m
    [22m[35mtrue [0m
    [22m[35mC3 := RootsCode( 4, [ 1, 2 ], 5 );[0m
    [22m[35mRootsOfCode( C3 );[0m
    [22m[35mC3 = ReedSolomonCode( 4, 3 );[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-4 BCHCode[0m
  
  [1m[34m> BCHCode( [0m[22m[34mn[, b,] delta, F[0m[1m[34m ) ______________________________________[0mfunction
  
  The function [22m[32mBCHCode[0m returns a 'Bose-Chaudhuri-Hockenghem code' (or [22m[36mBCH code[0m
  for  short). This is the largest possible cyclic code of length [22m[34mn[0m over field
  [22m[34mF[0m, whose generator polynomial has zeros
  
  \[
       a^{b},a^{b+1}, ..., a^{b+delta-2},
  \]
  
  where  a is a primitive n^th root of unity in the splitting field GF(q^m), [22m[34mb[0m
  is  an  integer  0<=  b<=  n-delta+1  and m is the multiplicative order of q
  modulo   [22m[34mn[0m.  (The  integers  b,...,b+delta-2  typically  lie  in  the  range
  1,...,n-1.)  Default  value for [22m[34mb[0m is 1, though the algorithm allows b=0. The
  length  [22m[34mn[0m  of the code and the size q of the field must be relatively prime.
  The  generator  polynomial  is  equal  to  the  least common multiple of the
  minimal polynomials of
  
  \[
       a^{b}, a^{b+1}, ..., a^{b+delta-2}.
  \]
  
  The  set  of zeroes of the generator polynomial is equal to the union of the
  sets
  
  \[
       \{a^x\ |\ x \in C_k\},
  \]
  
  where  C_k  is the k^th cyclotomic coset of q modulo n and b<= k<= b+delta-2
  (see [1m[34mCyclotomicCosets[0m ([1m7.5-12[0m)).
  
  Special cases are b=1 (resulting codes are called 'narrow-sense' BCH codes),
  and  n=q^m-1  (known as 'primitive' BCH codes). [1mGUAVA[0m calculates the largest
  value  of  d  for which the BCH code with designed distance d coincides with
  the  BCH  code  with  designed distance [22m[34mdelta[0m. This distance d is called the
  [22m[36mBose  distance[0m of the code. The true minimum distance of the code is greater
  than or equal to the Bose distance.
  
  Printed  are the designed distance (to be precise, the Bose distance) d, and
  the starting power b.
  
  The  Sugiyama  decoding  algorithm  has  been implemented for this code (see
  [1m[34mDecode[0m ([1m4.10-1[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := BCHCode( 15, 3, 5, GF(2) );[0m
    [22m[35ma cyclic [15,5,7]5 BCH code, delta=7, b=1 over GF(2)[0m
    [22m[35mgap> DesignedDistance( C1 );[0m
    [22m[35m7[0m
    [22m[35mgap> C2 := BCHCode( 23, 2, GF(2) );[0m
    [22m[35ma cyclic [23,12,5..7]3 BCH code, delta=5, b=1 over GF(2)[0m
    [22m[35mgap> DesignedDistance( C2 );       [0m
    [22m[35m5[0m
    [22m[35mgap> MinimumDistance(C2);[0m
    [22m[35m7 [0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mRootsCode[0m ([1m5.5-3[0m) for a more general construction.
  
  [1m[4m[31m5.5-5 ReedSolomonCode[0m
  
  [1m[34m> ReedSolomonCode( [0m[22m[34mn, d[0m[1m[34m ) __________________________________________[0mfunction
  
  [22m[32mReedSolomonCode[0m returns a 'Reed-Solomon code' of length [22m[34mn[0m, designed distance
  [22m[34md[0m.  This  code  is  a  primitive narrow-sense BCH code over the field GF(q),
  where  q=n+1.  The  dimension  of  an  RS  code  is  n-d+1. According to the
  Singleton  bound  (see  [1m[34mUpperBoundSingleton[0m ([1m7.1-1[0m)) the dimension cannot be
  greater  than this, so the true minimum distance of an RS code is equal to [22m[34md[0m
  and the code is maximum distance separable (see [1m[34mIsMDSCode[0m ([1m4.3-7[0m)).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := ReedSolomonCode( 3, 2 );[0m
    [22m[35ma cyclic [3,2,2]1 Reed-Solomon code over GF(4)[0m
    [22m[35mgap> IsCyclicCode(C1);[0m
    [22m[35mtrue[0m
    [22m[35mgap> C2 := ReedSolomonCode( 4, 3 );[0m
    [22m[35ma cyclic [4,2,3]2 Reed-Solomon code over GF(5)[0m
    [22m[35mgap> RootsOfCode( C2 );[0m
    [22m[35m[ Z(5), Z(5)^2 ][0m
    [22m[35mgap> IsMDSCode(C2);[0m
    [22m[35mtrue [0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mGeneralizedReedSolomonCode[0m ([1m5.6-2[0m) for a more general construction.
  
  [1m[4m[31m5.5-6 QRCode[0m
  
  [1m[34m> QRCode( [0m[22m[34mn, F[0m[1m[34m ) ___________________________________________________[0mfunction
  
  [22m[32mQRCode[0m  returns a quadratic residue code. If [22m[34mF[0m is a field GF(q), then q must
  be  a  quadratic  residue modulo [22m[34mn[0m. That is, an x exists with x^2 = q mod n.
  Both  [22m[34mn[0m and q must be primes. Its generator polynomial is the product of the
  polynomials  x-a^i. a is a primitive n^th root of unity, and i is an integer
  in the set of quadratic residues modulo [22m[34mn[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := QRCode( 7, GF(2) );[0m
    [22m[35ma cyclic [7,4,3]1 quadratic residue code over GF(2)[0m
    [22m[35mgap> IsEquivalent( C1, HammingCode( 3, GF(2) ) );[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsCyclicCode(C1);[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsCyclicCode(HammingCode( 3, GF(2) ));[0m
    [22m[35mfalse[0m
    [22m[35mgap> C2 := QRCode( 11, GF(3) );[0m
    [22m[35ma cyclic [11,6,4..5]2 quadratic residue code over GF(3)[0m
    [22m[35mgap> C2 = TernaryGolayCode();[0m
    [22m[35mtrue [0m
    [22m[35mgap> Q1 := QRCode( 7, GF(2));[0m
    [22m[35ma cyclic [7,4,3]1 quadratic residue code over GF(2)[0m
    [22m[35mgap> P1:=AutomorphismGroup(Q1); IdGroup(P1);[0m
    [22m[35mGroup([ (1,2)(5,7), (2,3)(4,7), (2,4)(5,6), (3,5)(6,7), (3,7)(5,6) ])[0m
    [22m[35m[ 168, 42 ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-7 QQRCodeNC[0m
  
  [1m[34m> QQRCodeNC( [0m[22m[34mp[0m[1m[34m ) ___________________________________________________[0mfunction
  
  [22m[32mQQRCodeNC[0m  is  the  same  as [22m[32mQQRCode[0m, except that it uses [22m[32mGeneratorMatCodeNC[0m
  instead of [22m[32mGeneratorMatCode[0m.
  
  [1m[4m[31m5.5-8 QQRCode[0m
  
  [1m[34m> QQRCode( [0m[22m[34mp[0m[1m[34m ) _____________________________________________________[0mfunction
  
  [22m[32mQQRCode[0m  returns  a  quasi-quadratic residue code, as defined by Proposition
  2.2  in  Bazzi-Mittel [BMT)]. The parameter [22m[34mp[0m must be a prime. Its generator
  matrix has the block form G=(Q,N). Here Q is a ptimes circulant matrix whose
  top  row  is  (0,x_1,...,x_p-1), where x_i=1 if and only if i is a quadratic
  residue  mod  p,  and  N  is  a  ptimes  circulant  matrix  whose top row is
  (0,y_1,...,y_p-1),  where  x_i+y_i=1 for all i. (In fact, this matrix can be
  recovered as the component [22m[32mDoublyCirculant[0m of the code.)
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C1 := QQRCode( 7);[0m
    [22m[35ma linear [14,7,1..4]3..5 code defined by generator matrix over GF(2)[0m
    [22m[35mgap> G1:=GeneratorMat(C1);;[0m
    [22m[35mgap> Display(G1);[0m
    [22m[35m . 1 1 . 1 . . . . . 1 . 1 1[0m
    [22m[35m 1 . 1 1 1 . . . . 1 1 1 . 1[0m
    [22m[35m . . . 1 1 . 1 . 1 1 . . . 1[0m
    [22m[35m . . 1 . 1 1 1 1 . 1 . . 1 1[0m
    [22m[35m . . . . . . . 1 . . 1 1 1 .[0m
    [22m[35m . . . . . . . . . 1 1 1 . 1[0m
    [22m[35m . . . . . . . . 1 . . 1 1 1[0m
    [22m[35mgap> Display(C1!.DoublyCirculant);[0m
    [22m[35m . 1 1 . 1 . . . . . 1 . 1 1[0m
    [22m[35m 1 1 . 1 . . . . . 1 . 1 1 .[0m
    [22m[35m 1 . 1 . . . 1 . 1 . 1 1 . .[0m
    [22m[35m . 1 . . . 1 1 1 . 1 1 . . .[0m
    [22m[35m 1 . . . 1 1 . . 1 1 . . . 1[0m
    [22m[35m . . . 1 1 . 1 1 1 . . . 1 .[0m
    [22m[35m . . 1 1 . 1 . 1 . . . 1 . 1[0m
    [22m[35mgap> MinimumDistance(C1);[0m
    [22m[35m4[0m
    [22m[35mgap> C2 := QQRCode( 29); MinimumDistance(C2);[0m
    [22m[35ma linear [58,28,1..14]8..29 code defined by generator matrix over GF(2)[0m
    [22m[35m12[0m
    [22m[35mgap> Aut2:=AutomorphismGroup(C2); IdGroup(Aut2);[0m
    [22m[35m[ permutation group of size 812 with 4 generators ][0m
    [22m[35m[ 812, 7 ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-9 FireCode[0m
  
  [1m[34m> FireCode( [0m[22m[34mg, b[0m[1m[34m ) _________________________________________________[0mfunction
  
  [22m[32mFireCode[0m  constructs  a  (binary)  Fire code. [22m[34mg[0m is a primitive polynomial of
  degree  m,  and a factor of x^r-1. [22m[34mb[0m an integer 0 <= b <= m not divisible by
  r,  that  determines  the  burst  length of a single error burst that can be
  corrected.  The  argument  [22m[34mg[0m  can be a polynomial with base ring GF(2), or a
  list  of  coefficients  in  GF(2).  The  generator polynomial of the code is
  defined as the product of [22m[34mg[0m and x^2b-1+1.
  
  Here  is  the  general  definition  of 'Fire code', named after P. Fire, who
  introduced  these  codes  in 1959 in order to correct burst errors. First, a
  definition.  If  F=GF(q)  and  fin  F[x]  then  we  say  f  has  [22m[36morder[0m  e if
  f(x)|(x^e-1).  A [22m[36mFire code[0m is a cyclic code over F with generator polynomial
  g(x)=  (x^2t-1-1)p(x),  where  p(x)  does  not divide x^2t-1-1 and satisfies
  deg(p(x))>=  t.  The  length of such a code is the order of g(x). Non-binary
  Fire codes have not been implemented.
  
  .
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> x:= Indeterminate( GF(2) );; G:= x^3+x^2+1;[0m
    [22m[35mZ(2)^0+x^2+x^3[0m
    [22m[35mgap> Factors( G );[0m
    [22m[35m[ Z(2)^0+x^2+x^3 ][0m
    [22m[35mgap> C := FireCode( G, 3 );[0m
    [22m[35ma cyclic [35,27,1..4]2..6 3 burst error correcting fire code over GF(2)[0m
    [22m[35mgap> MinimumDistance( C );[0m
    [22m[35m4     # Still it can correct bursts of length 3 [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-10 WholeSpaceCode[0m
  
  [1m[34m> WholeSpaceCode( [0m[22m[34mn, F[0m[1m[34m ) ___________________________________________[0mfunction
  
  [22m[32mWholeSpaceCode[0m  returns the cyclic whole space code of length [22m[34mn[0m over [22m[34mF[0m. This
  code  consists  of all polynomials of degree less than [22m[34mn[0m and coefficients in
  [22m[34mF[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := WholeSpaceCode( 5, GF(3) );[0m
    [22m[35ma cyclic [5,5,1]0 whole space code over GF(3)[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-11 NullCode[0m
  
  [1m[34m> NullCode( [0m[22m[34mn, F[0m[1m[34m ) _________________________________________________[0mfunction
  
  [22m[32mNullCode[0m  returns  the  zero-dimensional nullcode with length [22m[34mn[0m over [22m[34mF[0m. This
  code has only one word: the all zero word. It is cyclic though!
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := NullCode( 5, GF(3) );[0m
    [22m[35ma cyclic [5,0,5]5 nullcode over GF(3)[0m
    [22m[35mgap> AsSSortedList( C );[0m
    [22m[35m[ [ 0 0 0 0 0 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-12 RepetitionCode[0m
  
  [1m[34m> RepetitionCode( [0m[22m[34mn, F[0m[1m[34m ) ___________________________________________[0mfunction
  
  [22m[32mRepetitionCode[0m  returns  the  cyclic repetition code of length [22m[34mn[0m over [22m[34mF[0m. The
  code  has  as  many  elements  as  [22m[34mF[0m,  because  each  codeword consists of a
  repetition of one of these elements.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C := RepetitionCode( 3, GF(5) );[0m
    [22m[35ma cyclic [3,1,3]2 repetition code over GF(5)[0m
    [22m[35mgap> AsSSortedList( C );[0m
    [22m[35m[ [ 0 0 0 ], [ 1 1 1 ], [ 2 2 2 ], [ 4 4 4 ], [ 3 3 3 ] ][0m
    [22m[35mgap> IsPerfectCode( C );[0m
    [22m[35mfalse[0m
    [22m[35mgap> IsMDSCode( C );[0m
    [22m[35mtrue [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-13 CyclicCodes[0m
  
  [1m[34m> CyclicCodes( [0m[22m[34mn, F[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mCyclicCodes[0m  returns  a  list  of  all  cyclic  codes of length [22m[34mn[0m over [22m[34mF[0m. It
  constructs  all  possible  generator  polynomials from the factors of x^n-1.
  Each  combination  of  these  factors  yields  a  generator polynomial after
  multiplication.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> CyclicCodes(3,GF(3));[0m
    [22m[35m[ a cyclic [3,3,1]0 enumerated code over GF(3), [0m
    [22m[35ma cyclic [3,2,1..2]1 enumerated code over GF(3), [0m
    [22m[35ma cyclic [3,1,3]2 enumerated code over GF(3), [0m
    [22m[35ma cyclic [3,0,3]3 enumerated code over GF(3) ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.5-14 NrCyclicCodes[0m
  
  [1m[34m> NrCyclicCodes( [0m[22m[34mn, F[0m[1m[34m ) ____________________________________________[0mfunction
  
  The function [22m[32mNrCyclicCodes[0m calculates the number of cyclic codes of length [22m[34mn[0m
  over field [22m[34mF[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> NrCyclicCodes( 23, GF(2) );[0m
    [22m[35m8[0m
    [22m[35mgap> codelist := CyclicCodes( 23, GF(2) );[0m
    [22m[35m[ a cyclic [23,23,1]0 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,22,1..2]1 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,11,1..8]4..7 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,0,23]23 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,11,1..8]4..7 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,12,1..7]3 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,1,23]11 enumerated code over GF(2), [0m
    [22m[35m  a cyclic [23,12,1..7]3 enumerated code over GF(2) ][0m
    [22m[35mgap> BinaryGolayCode() in codelist;[0m
    [22m[35mtrue[0m
    [22m[35mgap> RepetitionCode( 23, GF(2) ) in codelist;[0m
    [22m[35mtrue[0m
    [22m[35mgap> CordaroWagnerCode( 23 ) in codelist;[0m
    [22m[35mfalse    # This code is not cyclic [0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m5.6 Evaluation Codes[0m
  
  [1m[4m[31m5.6-1 EvaluationCode[0m
  
  [1m[34m> EvaluationCode( [0m[22m[34mP, L, R[0m[1m[34m ) ________________________________________[0mfunction
  
  Input:  [22m[34mF[0m  is  a  finite  field,  [22m[34mL[0m  is  a  list  of  rational  functions in
  R=F[x_1,...,x_r],  [22m[34mP[0m  is  a  list  of  n  points  in F^r at which all of the
  functions in [22m[34mL[0m are defined.
  Output: The 'evaluation code' C, which is the image of the evalation map
  
  \[
       Eval_P:span(L)\rightarrow F^n,
  \]
  
  given  by  flongmapsto  (f(p_1),...,f(p_n)), where P=p_1,...,p_n and f in L.
  The generator matrix of C is G=(f_i(p_j))_f_iin L,p_jin P.
  
  This command returns a "record" object [22m[32mC[0m with several extra components (type
  [22m[32mNamesOfComponents(C)[0m to see them all): [22m[32mC!.EvaluationMat[0m (not the same as the
  generator matrix in general), [22m[32mC!.points[0m (namely [22m[34mP[0m), [22m[32mC!.basis[0m (namely [22m[34mL[0m), and
  [22m[32mC!.ring[0m (namely [22m[34mR[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R := PolynomialRing(F,2);;[0m
    [22m[35mgap> indets := IndeterminatesOfPolynomialRing(R);;[0m
    [22m[35mgap> x:=indets[1];; y:=indets[2];;[0m
    [22m[35mgap> L:=[x^2*y,x*y,x^5,x^4,x^3,x^2,x,x^0];;[0m
    [22m[35mgap> Pts:=[ [ Z(11)^9, Z(11) ], [ Z(11)^8, Z(11) ], [ Z(11)^7, 0*Z(11) ],[0m
    [22m[35m   [ Z(11)^6, 0*Z(11) ], [ Z(11)^5, 0*Z(11) ], [ Z(11)^4, 0*Z(11) ],[0m
    [22m[35m   [ Z(11)^3, Z(11) ], [ Z(11)^2, 0*Z(11) ], [ Z(11), 0*Z(11) ], [0m
    [22m[35m   [ Z(11)^0, 0*Z(11) ], [ 0*Z(11), Z(11) ] ];;[0m
    [22m[35mgap> C:=EvaluationCode(Pts,L,R);[0m
    [22m[35ma linear [11,8,1..3]2..3  evaluation code over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m3[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.6-2 GeneralizedReedSolomonCode[0m
  
  [1m[34m> GeneralizedReedSolomonCode( [0m[22m[34mP, k, R[0m[1m[34m ) ____________________________[0mfunction
  
  Input:  R=F[x],  where  [22m[34mF[0m is a finite field, [22m[34mk[0m is a positive integer, [22m[34mP[0m is a
  list of n points in F.
  Output: The C which is the image of the evaluation map
  
  \[
       Eval_P:F[x]_k\rightarrow F^n,
  \]
  
  given  by flongmapsto (f(p_1),...,f(p_n)), where P=p_1,...,p_nsubset F and f
  ranges over the space F[x]_k of all polynomials of degree less than k.
  
  This command returns a "record" object [22m[32mC[0m with several extra components (type
  [22m[32mNamesOfComponents(C)[0m  to  see  them  all):  [22m[32mC!.points[0m  (namely [22m[34mP[0m), [22m[32mC!.degree[0m
  (namely [22m[34mk[0m), and [22m[32mC!.ring[0m (namely [22m[34mR[0m).
  
  This code can be decoded using [22m[32mDecodeword[0m, which applies the special decoder
  method (the interpolation method), or using [22m[32mGeneralizedReedSolomonDecoderGao[0m
  which  applies  an algorithm of S. Gao (see [1m[34mGeneralizedReedSolomonDecoderGao[0m
  ([1m4.10-3[0m)).  This  code  has  a  special  decoder record which implements the
  interpolation  algorithm  described  in  section 5.2 of Justesen and Hoholdt
  [JH04]. See [1m[34mDecode[0m ([1m4.10-1[0m) and [1m[34mDecodeword[0m ([1m4.10-2[0m) for more details.
  
  The     weighted     version     has    implemented    with    the    option
  [22m[32mGeneralizedReedSolomonCode(P,k,R,wts)[0m,  where  wts  =  [v_1,  ..., v_n] is a
  sequence  of  n  non-zero  elements from the base field F of [22m[34mR[0m. See also the
  generalized Reed--Solomon code GRS_k(P, V) described in [MS83], p.303.
  
  The list-decoding algorithm of Sudan-Guraswami (described in section 12.1 of
  [JH04])  has  been  implemented  for  generalized  Reed-Solomon  codes.  See
  [1m[34mGeneralizedReedSolomonListDecoder[0m ([1m4.10-4[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> R:=PolynomialRing(GF(11),["t"]);[0m
    [22m[35mGF(11)[t][0m
    [22m[35mgap> P:=List([1,3,4,5,7],i->Z(11)^i);[0m
    [22m[35m[ Z(11), Z(11)^3, Z(11)^4, Z(11)^5, Z(11)^7 ][0m
    [22m[35mgap> C:=GeneralizedReedSolomonCode(P,3,R);[0m
    [22m[35ma linear [5,3,1..3]2  generalized Reed-Solomon code over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m3[0m
    [22m[35mgap> V:=[Z(11)^0,Z(11)^0,Z(11)^0,Z(11)^0,Z(11)];[0m
    [22m[35m[ Z(11)^0, Z(11)^0, Z(11)^0, Z(11)^0, Z(11) ][0m
    [22m[35mgap> C:=GeneralizedReedSolomonCode(P,3,R,V);[0m
    [22m[35ma linear [5,3,1..3]2  weighted generalized Reed-Solomon code over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m3[0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mEvaluationCode[0m ([1m5.6-1[0m) for a more general construction.
  
  [1m[4m[31m5.6-3 GeneralizedReedMullerCode[0m
  
  [1m[34m> GeneralizedReedMullerCode( [0m[22m[34mPts, r, F[0m[1m[34m ) ___________________________[0mfunction
  
  [22m[32mGeneralizedReedMullerCode[0m  returns  a 'Reed-Muller code' C with length |Pts|
  and  order  r.  One  considers (a) a basis of monomials for the vector space
  over  F=GF(q)  of all polynomials in F[x_1,...,x_d] of degree at most r, and
  (b)  a  set  Pts  of  points  in F^d. The generator matrix of the associated
  [22m[36mReed-Muller  code[0m  C  is G=(f(p))_fin B,p in Pts. This code C is constructed
  using the command [22m[32mGeneralizedReedMullerCode(Pts,r,F)[0m. When Pts is the set of
  all  q^d  points in F^d then the command [22m[32mGeneralizedReedMuller(d,r,F)[0m yields
  the code. When Pts is the set of all (q-1)^d points with no coordinate equal
  to  0  then  this  is  can  be constructed using the [22m[32mToricCode[0m command (as a
  special case).
  
  This command returns a "record" object [22m[32mC[0m with several extra components (type
  [22m[32mNamesOfComponents(C)[0m  to see them all): [22m[32mC!.points[0m (namely [22m[34mPts[0m) and [22m[32mC!.degree[0m
  (namely [22m[34mr[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> Pts:=ToricPoints(2,GF(5));[0m
    [22m[35m[ [ Z(5)^0, Z(5)^0 ], [ Z(5)^0, Z(5) ], [ Z(5)^0, Z(5)^2 ], [ Z(5)^0, Z(5)^3 ],[0m
    [22m[35m  [ Z(5), Z(5)^0 ], [ Z(5), Z(5) ], [ Z(5), Z(5)^2 ], [ Z(5), Z(5)^3 ],[0m
    [22m[35m  [ Z(5)^2, Z(5)^0 ], [ Z(5)^2, Z(5) ], [ Z(5)^2, Z(5)^2 ], [ Z(5)^2, Z(5)^3 ],[0m
    [22m[35m  [ Z(5)^3, Z(5)^0 ], [ Z(5)^3, Z(5) ], [ Z(5)^3, Z(5)^2 ], [ Z(5)^3, Z(5)^3 ] ][0m
    [22m[35mgap> C:=GeneralizedReedMullerCode(Pts,2,GF(5));[0m
    [22m[35ma linear [16,6,1..11]6..10  generalized Reed-Muller code over GF(5)[0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mEvaluationCode[0m ([1m5.6-1[0m) for a more general construction.
  
  [1m[4m[31m5.6-4 ToricPoints[0m
  
  [1m[34m> ToricPoints( [0m[22m[34mn, F[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[32mToricPoints(n,F)[0m returns the points in (F^times)^n.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> ToricPoints(2,GF(5));[0m
    [22m[35m[ [ Z(5)^0, Z(5)^0 ], [ Z(5)^0, Z(5) ], [ Z(5)^0, Z(5)^2 ], [0m
    [22m[35m  [ Z(5)^0, Z(5)^3 ], [ Z(5), Z(5)^0 ], [ Z(5), Z(5) ], [ Z(5), Z(5)^2 ], [0m
    [22m[35m  [ Z(5), Z(5)^3 ], [ Z(5)^2, Z(5)^0 ], [ Z(5)^2, Z(5) ], [ Z(5)^2, Z(5)^2 ], [0m
    [22m[35m  [ Z(5)^2, Z(5)^3 ], [ Z(5)^3, Z(5)^0 ], [ Z(5)^3, Z(5) ], [0m
    [22m[35m  [ Z(5)^3, Z(5)^2 ], [ Z(5)^3, Z(5)^3 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.6-5 ToricCode[0m
  
  [1m[34m> ToricCode( [0m[22m[34mL, F[0m[1m[34m ) ________________________________________________[0mfunction
  
  This  function returns the toric codes as in D. Joyner [J04] (see also J. P.
  Hansen [H99]). This is a truncated (generalized) Reed-Muller code. Here [22m[34mL[0m is
  a  list of integral vectors and [22m[34mF[0m is the finite field. The size of [22m[34mF[0m must be
  different from 2.
  
  This  command  returns  a  record  object  [22m[32mC[0m  with  an extra component (type
  [22m[32mNamesOfComponents(C)[0m to see them all): [22m[32mC!.exponents[0m (namely [22m[34mL[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> C:=ToricCode([[1,0],[3,4]],GF(3));[0m
    [22m[35ma linear [4,1,4]2 toric code over GF(3)[0m
    [22m[35mgap> Display(GeneratorMat(C));[0m
    [22m[35m 1 1 2 2[0m
    [22m[35mgap> Elements(C);[0m
    [22m[35m[ [ 0 0 0 0 ], [ 1 1 2 2 ], [ 2 2 1 1 ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mEvaluationCode[0m ([1m5.6-1[0m) for a more general construction.
  
  
  [1m[4m[31m5.7 Algebraic geometric codes[0m
  
  Certain  [1mGUAVA[0m  functions related to algebraic geometric codes are described
  in this section.
  
  [1m[4m[31m5.7-1 AffineCurve[0m
  
  [1m[34m> AffineCurve( [0m[22m[34mpoly, ring[0m[1m[34m ) ________________________________________[0mfunction
  
  This function simply defines the data structure of an affine plane curve. In
  [1mGUAVA[0m,  an  affine curve is a record [22m[34mcrv[0m having two components: a polynomial
  [22m[34mpoly[0m,  accessed  in  [1mGUAVA[0m  by  [22m[34mcrv.polynomial[0m, and a polynomial ring over a
  field  F  in  two  variables [22m[34mring[0m, accessed in [1mGUAVA[0m by [22m[34mcrv.ring[0m, containing
  [22m[34mpoly[0m. You use this function to define a curve in [1mGUAVA[0m.
  
  For  example,  for  the ring, one could take Q}[x,y], and for the polynomial
  one  could take f(x,y)=x^2+y^2-1. For the affine line, simply taking Q}[x,y]
  for the ring and f(x,y)=y for the polynomial.
  
  (Not sure if F neeeds to be a field in fact ...)
  
  To  compute  its degree, simply use the [1m[34mDegreeMultivariatePolynomial[0m ([1m7.6-2[0m)
  command.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap>[0m
    [22m[35mgap> F:=GF(11);;[0m
    [22m[35mgap> R2:=PolynomialRing(F,2);[0m
    [22m[35mPolynomialRing(..., [ x_1, x_2 ])[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R2);;[0m
    [22m[35mgap> x:=vars[1];; y:=vars[2];;[0m
    [22m[35mgap> poly:=y;; crvP1:=AffineCurve(poly,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), polynomial := x_2 )[0m
    [22m[35mgap> degree_crv:=DegreeMultivariatePolynomial(poly,R2);[0m
    [22m[35m1[0m
    [22m[35mgap> poly:=y^2-x*(x^2-1);; ell_crv:=AffineCurve(poly,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), polynomial := -x_1^3+x_2^2+x_1 )[0m
    [22m[35mgap> degree_crv:=DegreeMultivariatePolynomial(poly,R2);[0m
    [22m[35m3[0m
    [22m[35mgap> poly:=x^2+y^2-1;; circle:=AffineCurve(poly,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), polynomial := x_1^2+x_2^2-Z(11)^0 )[0m
    [22m[35mgap> degree_crv:=DegreeMultivariatePolynomial(poly,R2);[0m
    [22m[35m2[0m
    [22m[35mgap> q:=3;;[0m
    [22m[35mgap> F:=GF(q^2);;[0m
    [22m[35mgap> R:=PolynomialRing(F,2);;[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R);[0m
    [22m[35m[ x_1, x_2 ][0m
    [22m[35mgap> x:=vars[1];[0m
    [22m[35mx_1[0m
    [22m[35mgap> y:=vars[2];[0m
    [22m[35mx_2[0m
    [22m[35mgap> crv:=AffineCurve(y^q+y-x^(q+1),R);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), polynomial := -x_1^4+x_2^3+x_2 )[0m
    [22m[35mgap>[0m
  [22m[35m------------------------------------------------------------------[0m
  
  In  [1mGAP[0m,  a  [22m[36mpoint[0m  on a curve defined by f(x,y)=0 is simply a list [22m[34m[a,b][0m of
  elements of F satisfying this polynomial equation.
  
  [1m[4m[31m5.7-2 AffinePointsOnCurve[0m
  
  [1m[34m> AffinePointsOnCurve( [0m[22m[34mf, R, E[0m[1m[34m ) ___________________________________[0mfunction
  
  [22m[32mAffinePointsOnCurve(f,R,E)[0m   returns  the  points  (x,y)  in  E^2  satisying
  f(x,y)=0, where [22m[34mf[0m is an element of R=F[x,y].
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);;[0m
    [22m[35mgap> R := PolynomialRing(F,["x","y"]);[0m
    [22m[35mPolynomialRing(..., [ x, y ])[0m
    [22m[35mgap> indets := IndeterminatesOfPolynomialRing(R);;[0m
    [22m[35mgap> x:=indets[1];; y:=indets[2];;[0m
    [22m[35mgap> P:=AffinePointsOnCurve(y^2-x^11+x,R,F);[0m
    [22m[35m[ [ Z(11)^9, 0*Z(11) ], [ Z(11)^8, 0*Z(11) ], [ Z(11)^7, 0*Z(11) ], [0m
    [22m[35m  [ Z(11)^6, 0*Z(11) ], [ Z(11)^5, 0*Z(11) ], [ Z(11)^4, 0*Z(11) ], [0m
    [22m[35m  [ Z(11)^3, 0*Z(11) ], [ Z(11)^2, 0*Z(11) ], [ Z(11), 0*Z(11) ], [0m
    [22m[35m  [ Z(11)^0, 0*Z(11) ], [ 0*Z(11), 0*Z(11) ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-3 GenusCurve[0m
  
  [1m[34m> GenusCurve( [0m[22m[34mcrv[0m[1m[34m ) ________________________________________________[0mfunction
  
  If  [22m[34mcrv[0m  represents f(x,y)=0, where f is a polynomial of degree d, then this
  function  simply returns (d-1)(d-2)/2. At the present, the function does not
  check if the curve is singular (in which case the result may be false).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> q:=4;;[0m
    [22m[35mgap> F:=GF(q^2);;[0m
    [22m[35mgap> a:=X(F);;[0m
    [22m[35mgap> R1:=PolynomialRing(F,[a]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);;[0m
    [22m[35mgap> b:=X(F);;[0m
    [22m[35mgap> R2:=PolynomialRing(F,[a,b]);;[0m
    [22m[35mgap> var2:=IndeterminatesOfPolynomialRing(R2);;[0m
    [22m[35mgap> crv:=AffineCurve(b^q+b-a^(q+1),R2);;[0m
    [22m[35mgap> crv:=AffineCurve(b^q+b-a^(q+1),R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_1 ]), polynomial := x_1^5+x_1^4+x_1 )[0m
    [22m[35mgap> GenusCurve(crv);[0m
    [22m[35m36[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-4 GOrbitPoint [0m
  
  [1m[34m> GOrbitPoint ( [0m[22m[34mG, P[0m[1m[34m ) _____________________________________________[0mfunction
  
  [22m[34mP[0m must be a point in projective space P^n(F), [22m[34mG[0m must be a finite subgroup of
  GL(n+1,F),  This function returns all (representatives of projective) points
  in the orbit G* P.
  
  The  example below computes the orbit of the automorphism group on the Klein
  quartic over the field GF(43) on the ``point at infinity''.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> R:= PolynomialRing( GF(43), 3 );;[0m
    [22m[35mgap> vars:= IndeterminatesOfPolynomialRing(R);;[0m
    [22m[35mgap> x:= vars[1];; y:= vars[2];; z:= vars[3];;[0m
    [22m[35mgap> zz:=Z(43)^6;[0m
    [22m[35mZ(43)^6[0m
    [22m[35mgap> zzz:=Z(43);[0m
    [22m[35mZ(43)[0m
    [22m[35mgap> rho1:=zz^0*[[zz^4,0,0],[0,zz^2,0],[0,0,zz]];[0m
    [22m[35m[ [ Z(43)^24, 0*Z(43), 0*Z(43) ], [0m
    [22m[35m[ 0*Z(43), Z(43)^12, 0*Z(43) ], [0m
    [22m[35m[ 0*Z(43), 0*Z(43), Z(43)^6 ] ][0m
    [22m[35mgap> rho2:=zz^0*[[0,1,0],[0,0,1],[1,0,0]];[0m
    [22m[35m[ [ 0*Z(43), Z(43)^0, 0*Z(43) ], [0m
    [22m[35m[ 0*Z(43), 0*Z(43), Z(43)^0 ], [0m
    [22m[35m[ Z(43)^0, 0*Z(43), 0*Z(43) ] ][0m
    [22m[35mgap> rho3:=(-1)*[[(zz-zz^6 )/zzz^7,( zz^2-zz^5 )/ zzz^7, ( zz^4-zz^3 )/ zzz^7],[0m
    [22m[35m>             [( zz^2-zz^5 )/ zzz^7, ( zz^4-zz^3 )/ zzz^7, ( zz-zz^6 )/ zzz^7],[0m
    [22m[35m>             [( zz^4-zz^3 )/ zzz^7, ( zz-zz^6 )/ zzz^7, ( zz^2-zz^5 )/ zzz^7]];[0m
    [22m[35m[ [ Z(43)^9, Z(43)^28, Z(43)^12 ], [0m
    [22m[35m[ Z(43)^28, Z(43)^12, Z(43)^9 ], [0m
    [22m[35m[ Z(43)^12, Z(43)^9, Z(43)^28 ] ][0m
    [22m[35mgap> G:=Group([rho1,rho2,rho3]);; #PSL(2,7)[0m
    [22m[35mgap> Size(G);[0m
    [22m[35m168[0m
    [22m[35mgap> P:=[1,0,0]*zzz^0;[0m
    [22m[35m[ Z(43)^0, 0*Z(43), 0*Z(43) ][0m
    [22m[35mgap> O:=GOrbitPoint(G,P);[0m
    [22m[35m[ [ Z(43)^0, 0*Z(43), 0*Z(43) ], [ 0*Z(43), Z(43)^0, 0*Z(43) ], [0m
    [22m[35m[ 0*Z(43), 0*Z(43), Z(43)^0 ], [ Z(43)^0, Z(43)^39, Z(43)^16 ], [0m
    [22m[35m[ Z(43)^0, Z(43)^33, Z(43)^28 ], [ Z(43)^0, Z(43)^27, Z(43)^40 ],[0m
    [22m[35m[ Z(43)^0, Z(43)^21, Z(43)^10 ], [ Z(43)^0, Z(43)^15, Z(43)^22 ], [0m
    [22m[35m[ Z(43)^0, Z(43)^9, Z(43)^34 ], [ Z(43)^0, Z(43)^3, Z(43)^4 ], [0m
    [22m[35m[ Z(43)^3, Z(43)^22, Z(43)^6 ], [ Z(43)^3, Z(43)^16, Z(43)^18 ],[0m
    [22m[35m[ Z(43)^3, Z(43)^10, Z(43)^30 ], [ Z(43)^3, Z(43)^4, Z(43)^0 ], [0m
    [22m[35m[ Z(43)^3, Z(43)^40, Z(43)^12 ], [ Z(43)^3, Z(43)^34, Z(43)^24 ], [0m
    [22m[35m[ Z(43)^3, Z(43)^28, Z(43)^36 ], [ Z(43)^4, Z(43)^30, Z(43)^27 ],[0m
    [22m[35m[ Z(43)^4, Z(43)^24, Z(43)^39 ], [ Z(43)^4, Z(43)^18, Z(43)^9 ], [0m
    [22m[35m[ Z(43)^4, Z(43)^12, Z(43)^21 ], [ Z(43)^4, Z(43)^6, Z(43)^33 ], [0m
    [22m[35m[ Z(43)^4, Z(43)^0, Z(43)^3 ], [ Z(43)^4, Z(43)^36, Z(43)^15 ] ][0m
    [22m[35mgap> Length(O);[0m
    [22m[35m24[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  Informally,  a  [22m[36mdivisor[0m on a curve is a formal integer linear combination of
  points  on  the  curve, D=m_1P_1+...+m_kP_k, where the m_i are integers (the
  ``multiplicity''  of P_i in D) and P_i are (F-rational) points on the affine
  plane  curve.  In  other  words, a divisor is an element of the free abelian
  group generated by the F-rational affine points on the curve. The [22m[36msupport[0m of
  a  divisor  D is simply the set of points which occurs in the sum defining D
  with  non-zero  ``multiplicity''.  The  data  structure  for a divisor on an
  affine plane curve is a record having the following components:
  
  --    the coefficients (the integer weights of the points in the support),
  
  --    the support,
  
  --    the  curve,  itself  a  record  which  has  components: polynomial and
        polynomial ring.
  
  [1m[4m[31m5.7-5 DivisorOnAffineCurve[0m
  
  [1m[34m> DivisorOnAffineCurve( [0m[22m[34mcdiv, sdiv, crv[0m[1m[34m ) __________________________[0mfunction
  
  This  is the command you use to define a divisor in [1mGUAVA[0m. Of course, [22m[34mcrv[0m is
  the  curve  on which the divisor lives, [22m[34mcdiv[0m is the list of coefficients (or
  ``multiplicities''), [22m[34msdiv[0m is the list of points on [22m[34mcrv[0m in the support.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> q:=5;[0m
    [22m[35m5[0m
    [22m[35mgap> F:=GF(q);[0m
    [22m[35mGF(5)[0m
    [22m[35mgap> R:=PolynomialRing(F,2);;[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R);[0m
    [22m[35m[ x_1, x_2 ][0m
    [22m[35mgap> x:=vars[1];[0m
    [22m[35mx_1[0m
    [22m[35mgap> y:=vars[2];[0m
    [22m[35mx_2[0m
    [22m[35mgap> crv:=AffineCurve(y^3-x^3-x-1,R);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), [0m
    [22m[35m     polynomial := -x_1^3+x_2^3-x_1-Z(5)^0 )[0m
    [22m[35mgap> Pts:=AffinePointsOnCurve(crv,R,F);;[0m
    [22m[35mgap> supp:=[Pts[1],Pts[2]];[0m
    [22m[35m[ [ 0*Z(5), Z(5)^0 ], [ Z(5)^0, Z(5) ] ][0m
    [22m[35mgap> D:=DivisorOnAffineCurve([1,-1],supp,crv);[0m
    [22m[35mrec( coeffs := [ 1, -1 ], [0m
    [22m[35m     support := [ [ 0*Z(5), Z(5)^0 ], [ Z(5)^0, Z(5) ] ],[0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ x_1, x_2 ]), [0m
    [22m[35m                   polynomial := -x_1^3+x_2^3-x_1-Z(5)^0 ) )[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-6 DivisorAddition [0m
  
  [1m[34m> DivisorAddition ( [0m[22m[34mD1, D2[0m[1m[34m ) _______________________________________[0mfunction
  
  If   D_1=m_1P_1+...+m_kP_k   and  D_2=n_1P_1+...+n_kP_k  are  divisors  then
  D_1+D_2=(m_1+n_1)P_1+...+(m_k+n_k)P_k.
  
  [1m[4m[31m5.7-7 DivisorDegree [0m
  
  [1m[34m> DivisorDegree ( [0m[22m[34mD[0m[1m[34m ) ______________________________________________[0mfunction
  
  If D=m_1P_1+...+m_kP_k is a divisor then the [22m[36mdegree[0m is m_1+...+m_k.
  
  [1m[4m[31m5.7-8 DivisorNegate [0m
  
  [1m[34m> DivisorNegate ( [0m[22m[34mD[0m[1m[34m ) ______________________________________________[0mfunction
  
  Self-explanatory.
  
  [1m[4m[31m5.7-9 DivisorIsZero [0m
  
  [1m[34m> DivisorIsZero ( [0m[22m[34mD[0m[1m[34m ) ______________________________________________[0mfunction
  
  Self-explanatory.
  
  [1m[4m[31m5.7-10 DivisorsEqual [0m
  
  [1m[34m> DivisorsEqual ( [0m[22m[34mD1, D2[0m[1m[34m ) _________________________________________[0mfunction
  
  Self-explanatory.
  
  [1m[4m[31m5.7-11 DivisorGCD [0m
  
  [1m[34m> DivisorGCD ( [0m[22m[34mD1, D2[0m[1m[34m ) ____________________________________________[0mfunction
  
  If  m=p_1^e_1...p_k^e_k  and n=p_1^f_1...p_k^f_k are two integers then their
  greatest  common  divisor is GCD(m,n)=p_1^min(e_1,f_1)...p_k^min(e_k,f_k). A
  similar    definition    works   for   two   divisors   on   a   curve.   If
  D_1=e_1P_1+...+e_kP_k and D_2n=f_1P_1+...+f_kP_k are two divisors on a curve
  then         their         [22m[36mgreatest         common         divisor[0m        is
  GCD(m,n)=min(e_1,f_1)P_1+...+min(e_k,f_k)P_k.  This  function  computes this
  quantity.
  
  [1m[4m[31m5.7-12 DivisorLCM [0m
  
  [1m[34m> DivisorLCM ( [0m[22m[34mD1, D2[0m[1m[34m ) ____________________________________________[0mfunction
  
  If  m=p_1^e_1...p_k^e_k  and n=p_1^f_1...p_k^f_k are two integers then their
  least  common  multiple  is  LCM(m,n)=p_1^max(e_1,f_1)...p_k^max(e_k,f_k). A
  similar    definition    works   for   two   divisors   on   a   curve.   If
  D_1=e_1P_1+...+e_kP_k  and D_2=f_1P_1+...+f_kP_k are two divisors on a curve
  then          their         [22m[36mleast         common         multiple[0m         is
  LCM(m,n)=max(e_1,f_1)P_1+...+max(e_k,f_k)P_k.  This  function  computes this
  quantity.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> crvP1:=AffineCurve(b,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ a, b ]), polynomial := b )[0m
    [22m[35mgap> div1:=DivisorOnAffineCurve([1,2,3,4],[Z(11)^2,Z(11)^3,Z(11)^7,Z(11)],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> DivisorDegree(div1);[0m
    [22m[35m10[0m
    [22m[35mgap> div2:=DivisorOnAffineCurve([1,2,3,4],[Z(11),Z(11)^2,Z(11)^3,Z(11)^4],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11), Z(11)^2, Z(11)^3, Z(11)^4 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> DivisorDegree(div2);[0m
    [22m[35m10[0m
    [22m[35mgap> div3:=DivisorAddition(div1,div2);[0m
    [22m[35mrec( coeffs := [ 5, 3, 5, 4, 3 ], [0m
    [22m[35m     support := [ Z(11), Z(11)^2, Z(11)^3, Z(11)^4, Z(11)^7 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> DivisorDegree(div3);[0m
    [22m[35m20[0m
    [22m[35mgap> DivisorIsEffective(div1);[0m
    [22m[35mtrue[0m
    [22m[35mgap> DivisorIsEffective(div2);[0m
    [22m[35mtrue[0m
    [22m[35mgap>[0m
    [22m[35mgap> ndiv1:=DivisorNegate(div1);[0m
    [22m[35mrec( coeffs := [ -1, -2, -3, -4 ], [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> zdiv:=DivisorAddition(div1,ndiv1);[0m
    [22m[35mrec( coeffs := [ 0, 0, 0, 0 ], [0m
    [22m[35m     support := [ Z(11), Z(11)^2, Z(11)^3, Z(11)^7 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> DivisorIsZero(zdiv);[0m
    [22m[35mtrue[0m
    [22m[35mgap> div_gcd:=DivisorGCD(div1,div2);[0m
    [22m[35mrec( coeffs := [ 1, 1, 2, 0, 0 ], [0m
    [22m[35m     support := [ Z(11), Z(11)^2, Z(11)^3, Z(11)^4, Z(11)^7 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> div_lcm:=DivisorLCM(div1,div2);[0m
    [22m[35mrec( coeffs := [ 4, 2, 3, 4, 3 ], [0m
    [22m[35m     support := [ Z(11), Z(11)^2, Z(11)^3, Z(11)^4, Z(11)^7 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> DivisorDegree(div_gcd);[0m
    [22m[35m4[0m
    [22m[35mgap> DivisorDegree(div_lcm);[0m
    [22m[35m16[0m
    [22m[35mgap> DivisorEqual(div3,DivisorAddition(div_gcd,div_lcm));[0m
    [22m[35mtrue[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  Let G denote a finite subgroup of PGL(2,F) and let D denote a divisor on the
  projective  line  P^1(F). If G leaves D unchanged (it may permute the points
  in  the support of D but must preserve their sum in D) then the Riemann-Roch
  space  L(D)  is  a  G-module.  The commands in this section help explore the
  G-module structure of L(D) in the case then the ground field F is finite.
  
  [1m[4m[31m5.7-13 RiemannRochSpaceBasisFunctionP1 [0m
  
  [1m[34m> RiemannRochSpaceBasisFunctionP1 ( [0m[22m[34mP, k, R2[0m[1m[34m ) _____________________[0mfunction
  
  Input: [22m[34mR2[0m is a polynomial ring in two variables, say F[x,y]; [22m[34mP[0m is an element
  of the base field, say F; [22m[34mk[0m is an integer. Output: 1/(x-P)^k
  
  [1m[4m[31m5.7-14 DivisorOfRationalFunctionP1 [0m
  
  [1m[34m> DivisorOfRationalFunctionP1 ( [0m[22m[34mf, R[0m[1m[34m ) _____________________________[0mfunction
  
  Here  R  =  F[x,y]  is  a  polynomial  ring  in the variables x,y and f is a
  rational  function  of  x.  Simply  returns  the  principal  divisor on P}^1
  associated to f.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> pt:=Z(11);[0m
    [22m[35mZ(11)[0m
    [22m[35mgap> f:=RiemannRochSpaceBasisFunctionP1(pt,2,R2);[0m
    [22m[35m(Z(11)^0)/(a^2+Z(11)^7*a+Z(11)^2)[0m
    [22m[35mgap> Df:=DivisorOfRationalFunctionP1(f,R2);[0m
    [22m[35mrec( coeffs := [ -2 ], support := [ Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := a )[0m
    [22m[35m   )[0m
    [22m[35mgap> Df.support;[0m
    [22m[35m[ Z(11) ][0m
    [22m[35mgap> F:=GF(11);;[0m
    [22m[35mgap> R:=PolynomialRing(F,2);;[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R);;[0m
    [22m[35mgap> a:=vars[1];;[0m
    [22m[35mgap> b:=vars[2];;[0m
    [22m[35mgap> f:=(a^4+Z(11)^6*a^3-a^2+Z(11)^7*a+Z(11)^0)/(a^4+Z(11)*a^2+Z(11)^7*a+Z(11));;[0m
    [22m[35mgap> divf:=DivisorOfRationalFunctionP1(f,R);[0m
    [22m[35mrec( coeffs := [ 3, 1 ], support := [ Z(11), Z(11)^7 ],[0m
    [22m[35m  curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := a ) )[0m
    [22m[35mgap> denf:=DenominatorOfRationalFunction(f); RootsOfUPol(denf);[0m
    [22m[35ma^4+Z(11)*a^2+Z(11)^7*a+Z(11)[0m
    [22m[35m[  ][0m
    [22m[35mgap> numf:=NumeratorOfRationalFunction(f); RootsOfUPol(numf);[0m
    [22m[35ma^4+Z(11)^6*a^3-a^2+Z(11)^7*a+Z(11)^0[0m
    [22m[35m[ Z(11)^7, Z(11), Z(11), Z(11) ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-15 RiemannRochSpaceBasisP1 [0m
  
  [1m[34m> RiemannRochSpaceBasisP1 ( [0m[22m[34mD[0m[1m[34m ) ____________________________________[0mfunction
  
  This  returns  the  basis  of  the Riemann-Roch space L(D) associated to the
  divisor [22m[34mD[0m on the projective line P}^1.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> crvP1:=AffineCurve(b,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ a, b ]), polynomial := b )[0m
    [22m[35mgap> D:=DivisorOnAffineCurve([1,2,3,4],[Z(11)^2,Z(11)^3,Z(11)^7,Z(11)],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> B:=RiemannRochSpaceBasisP1(D);[0m
    [22m[35m[ Z(11)^0, (Z(11)^0)/(a+Z(11)^7), (Z(11)^0)/(a+Z(11)^8), [0m
    [22m[35m(Z(11)^0)/(a^2+Z(11)^9*a+Z(11)^6), (Z(11)^0)/(a+Z(11)^2), [0m
    [22m[35m(Z(11)^0)/(a^2+Z(11)^3*a+Z(11)^4), (Z(11)^0)/(a^3+a^2+Z(11)^2*a+Z(11)^6),[0m
    [22m[35m  (Z(11)^0)/(a+Z(11)^6), (Z(11)^0)/(a^2+Z(11)^7*a+Z(11)^2), [0m
    [22m[35m(Z(11)^0)/(a^3+Z(11)^4*a^2+a+Z(11)^8), [0m
    [22m[35m(Z(11)^0)/(a^4+Z(11)^8*a^3+Z(11)*a^2+a+Z(11)^4) ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[1],R2).support;[0m
    [22m[35m[  ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[2],R2).support;[0m
    [22m[35m[ Z(11)^2 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[3],R2).support;[0m
    [22m[35m[ Z(11)^3 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[4],R2).support;[0m
    [22m[35m[ Z(11)^3 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[5],R2).support;[0m
    [22m[35m[ Z(11)^7 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[6],R2).support;[0m
    [22m[35m[ Z(11)^7 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[7],R2).support;[0m
    [22m[35m[ Z(11)^7 ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[8],R2).support;[0m
    [22m[35m[ Z(11) ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[9],R2).support;[0m
    [22m[35m[ Z(11) ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[10],R2).support;[0m
    [22m[35m[ Z(11) ][0m
    [22m[35mgap> DivisorOfRationalFunctionP1(B[11],R2).support;[0m
    [22m[35m[ Z(11) ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-16 MoebiusTransformation [0m
  
  [1m[34m> MoebiusTransformation ( [0m[22m[34mA, R[0m[1m[34m ) ___________________________________[0mfunction
  
  The  arguments  are  a  2times  2  matrix  A with entries in a field F and a
  polynomial ring [22m[34mR[0mof one variable, say F[x]. This function returns the linear
  fractional  transformatio  associated  to  [22m[34mA[0m.  These  transformations can be
  composed with each other using [1mGAP[0m's [22m[32mValue[0m command.
  
  [1m[4m[31m5.7-17 ActionMoebiusTransformationOnFunction [0m
  
  [1m[34m> ActionMoebiusTransformationOnFunction ( [0m[22m[34mA, f, R2[0m[1m[34m ) _______________[0mfunction
  
  The  arguments are a 2times 2 matrix A with entries in a field F, a rational
  function  [22m[34mf[0m  of  one  variable,  say  in F(x), and a polynomial ring [22m[34mR2[0m, say
  F[x,y].  This function simply returns the composition of the function [22m[34mf[0m with
  the M\"obius transformation of [22m[34mA[0m.
  
  [1m[4m[31m5.7-18 ActionMoebiusTransformationOnDivisorP1 [0m
  
  [1m[34m> ActionMoebiusTransformationOnDivisorP1 ( [0m[22m[34mA, D[0m[1m[34m ) __________________[0mfunction
  
  A  M\"obius  transformation  may  be  regarded  as  an  automorphism  of the
  projective line P^1. This function simply returns the image of the divisor [22m[34mD[0m
  under   the   M\"obius   transformation   defined   by   [22m[34mA[0m,   provided  that
  [22m[32mIsActionMoebiusTransformationOnDivisorDefinedP1(A,D)[0m returns true.
  
  [1m[4m[31m5.7-19 IsActionMoebiusTransformationOnDivisorDefinedP1 [0m
  
  [1m[34m> IsActionMoebiusTransformationOnDivisorDefinedP1 ( [0m[22m[34mA, D[0m[1m[34m ) _________[0mfunction
  
  Returns  true  of  none of the points in the support of the divisor [22m[34mD[0m is the
  pole of the M\"obius transformation.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> crvP1:=AffineCurve(b,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ a, b ]), polynomial := b )[0m
    [22m[35mgap> D:=DivisorOnAffineCurve([1,2,3,4],[Z(11)^2,Z(11)^3,Z(11)^7,Z(11)],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> A:=Z(11)^0*[[1,2],[1,4]];[0m
    [22m[35m[ [ Z(11)^0, Z(11) ], [ Z(11)^0, Z(11)^2 ] ][0m
    [22m[35mgap> ActionMoebiusTransformationOnDivisorDefinedP1(A,D);[0m
    [22m[35mfalse[0m
    [22m[35mgap> A:=Z(11)^0*[[1,2],[3,4]];[0m
    [22m[35m[ [ Z(11)^0, Z(11) ], [ Z(11)^8, Z(11)^2 ] ][0m
    [22m[35mgap> ActionMoebiusTransformationOnDivisorDefinedP1(A,D);[0m
    [22m[35mtrue[0m
    [22m[35mgap> ActionMoebiusTransformationOnDivisorP1(A,D);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11)^5, Z(11)^6, Z(11)^8, Z(11)^7 ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> f:=MoebiusTransformation(A,R1);[0m
    [22m[35m(a+Z(11))/(Z(11)^8*a+Z(11)^2)[0m
    [22m[35mgap> ActionMoebiusTransformationOnFunction(A,f,R1);[0m
    [22m[35m-Z(11)^0+Z(11)^3*a^-1[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-20 DivisorAutomorphismGroupP1 [0m
  
  [1m[34m> DivisorAutomorphismGroupP1 ( [0m[22m[34mD[0m[1m[34m ) _________________________________[0mfunction
  
  Input:  A divisor [22m[34mD[0m on P^1(F), where F is a finite field. Output: A subgroup
  Aut(D)subset Aut(P^1) preserving [22m[34mD[0m.
  
  Very slow.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> crvP1:=AffineCurve(b,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ a, b ]), polynomial := b )[0m
    [22m[35mgap> D:=DivisorOnAffineCurve([1,2,3,4],[Z(11)^2,Z(11)^3,Z(11)^7,Z(11)],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 2, 3, 4 ], [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> agp:=DivisorAutomorphismGroupP1(D);; time;[0m
    [22m[35m7305[0m
    [22m[35mgap> IdGroup(agp);[0m
    [22m[35m[ 10, 2 ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-21 MatrixRepresentationOnRiemannRochSpaceP1 [0m
  
  [1m[34m> MatrixRepresentationOnRiemannRochSpaceP1 ( [0m[22m[34mg, D[0m[1m[34m ) ________________[0mfunction
  
  Input: An element [22m[34mg[0m in G, a subgroup of Aut(D)subset Aut(P^1), and a divisor
  [22m[34mD[0m on P^1(F), where F is a finite field. Output: a dtimes d matrix, where d =
  dim, L(D), representing the action of [22m[34mg[0m on L(D).
  
  Note: [22m[34mg[0m sends L(D) to r* L(D), where r is a polynomial of degree 1 depending
  on [22m[34mg[0m and [22m[34mD[0m.
  
  Also very slow.
  
  The [1mGAP[0m command [22m[32mBrauerCharacterValue[0m can be used to ``lift'' the eigenvalues
  of this matrix to the complex numbers.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R1:=PolynomialRing(F,["a"]);;[0m
    [22m[35mgap> var1:=IndeterminatesOfPolynomialRing(R1);; a:=var1[1];;[0m
    [22m[35mgap> b:=X(F,"b",var1);[0m
    [22m[35mb[0m
    [22m[35mgap> var2:=Concatenation(var1,[b]);[0m
    [22m[35m[ a, b ][0m
    [22m[35mgap> R2:=PolynomialRing(F,var2);[0m
    [22m[35mPolynomialRing(..., [ a, b ])[0m
    [22m[35mgap> crvP1:=AffineCurve(b,R2);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ a, b ]), polynomial := b )[0m
    [22m[35mgap> D:=DivisorOnAffineCurve([1,1,1,4],[Z(11)^2,Z(11)^3,Z(11)^7,Z(11)],crvP1);[0m
    [22m[35mrec( coeffs := [ 1, 1, 1, 4 ],  [0m
    [22m[35m     support := [ Z(11)^2, Z(11)^3, Z(11)^7, Z(11) ], [0m
    [22m[35m     curve := rec( ring := PolynomialRing(..., [ a, b ]), polynomial := b ) )[0m
    [22m[35mgap> agp:=DivisorAutomorphismGroupP1(D);; time;[0m
    [22m[35m7198[0m
    [22m[35mgap> IdGroup(agp);[0m
    [22m[35m[ 20, 5 ][0m
    [22m[35mgap> g:=Random(agp);[0m
    [22m[35m[ [ Z(11)^4, Z(11)^9 ], [ Z(11)^0, Z(11)^9 ] ][0m
    [22m[35mgap> rho:=MatrixRepresentationOnRiemannRochSpaceP1(g,D);[0m
    [22m[35m[ [ Z(11)^0, 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11) ], [0m
    [22m[35m[ Z(11)^0, 0*Z(11), 0*Z(11), Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11) ],[0m
    [22m[35m  [ Z(11)^7, 0*Z(11), Z(11)^5, 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11) ], [0m
    [22m[35m[ Z(11)^4, Z(11)^9, 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11), 0*Z(11) ],[0m
    [22m[35m  [ Z(11)^2, 0*Z(11), 0*Z(11), 0*Z(11), Z(11)^5, 0*Z(11), 0*Z(11), 0*Z(11) ], [0m
    [22m[35m[ Z(11)^4, 0*Z(11), 0*Z(11), 0*Z(11), Z(11)^8, Z(11)^0, 0*Z(11), 0*Z(11) ],[0m
    [22m[35m  [ Z(11)^6, 0*Z(11), 0*Z(11), 0*Z(11), Z(11)^7, Z(11)^0, Z(11)^5, 0*Z(11) ], [0m
    [22m[35m[ Z(11)^8, 0*Z(11), 0*Z(11), 0*Z(11), Z(11)^3, Z(11)^3, Z(11)^9, Z(11)^0 ] ][0m
    [22m[35mgap> Display(rho);[0m
    [22m[35m  1  .  .  .  .  .  .  .[0m
    [22m[35m  1  .  .  2  .  .  .  .[0m
    [22m[35m  7  . 10  .  .  .  .  .[0m
    [22m[35m  5  6  .  .  .  .  .  .[0m
    [22m[35m  4  .  .  . 10  .  .  .[0m
    [22m[35m  5  .  .  .  3  1  .  .[0m
    [22m[35m  9  .  .  .  7  1 10  .[0m
    [22m[35m  3  .  .  .  8  8  6  1[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-22 GoppaCodeClassical[0m
  
  [1m[34m> GoppaCodeClassical( [0m[22m[34mdiv, pts[0m[1m[34m ) ___________________________________[0mfunction
  
  Input:  A  divisor  [22m[34mdiv[0m on the projective line P}^1(F) over a finite field F
  and  a  list  [22m[34mpts[0m of points P_1,...,P_nsubset F disjoint from the support of
  [22m[34mdiv[0m.
  Output:  The classical (evaluation) Goppa code associated to this data. This
  is the code
  
  \[
       C=\{(f(P_1),...,f(P_n))\ |\ f\in L(D)_F\}.
  \]
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);;[0m
    [22m[35mgap> R2:=PolynomialRing(F,2);;[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R2);;[0m
    [22m[35mgap> a:=vars[1];;b:=vars[2];;[0m
    [22m[35mgap> cdiv:=[ 1, 2, -1, -2 ];[0m
    [22m[35m[ 1, 2, -1, -2 ][0m
    [22m[35mgap> sdiv:=[ Z(11)^2, Z(11)^3, Z(11)^6, Z(11)^9 ];[0m
    [22m[35m[ Z(11)^2, Z(11)^3, Z(11)^6, Z(11)^9 ][0m
    [22m[35mgap> crv:=rec(polynomial:=b,ring:=R2);[0m
    [22m[35mrec( polynomial := x_2, ring := PolynomialRing(..., [ x_1, x_2 ]) )[0m
    [22m[35mgap> div:=DivisorOnAffineCurve(cdiv,sdiv,crv);[0m
    [22m[35mrec( coeffs := [ 1, 2, -1, -2 ], support := [ Z(11)^2, Z(11)^3, Z(11)^6, Z(11)^9 ],[0m
    [22m[35m  curve := rec( polynomial := x_2, ring := PolynomialRing(..., [ x_1, x_2 ]) ) )[0m
    [22m[35mgap> pts:=Difference(Elements(GF(11)),div.support);[0m
    [22m[35m[ 0*Z(11), Z(11)^0, Z(11), Z(11)^4, Z(11)^5, Z(11)^7, Z(11)^8 ][0m
    [22m[35mgap> C:=GoppaCodeClassical(div,pts);[0m
    [22m[35ma linear [7,2,1..6]4..5 code defined by generator matrix over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m6[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-23 EvaluationBivariateCode[0m
  
  [1m[34m> EvaluationBivariateCode( [0m[22m[34mpts, L, crv[0m[1m[34m ) ___________________________[0mfunction
  
  Input:  [22m[32mpts[0m  is  a  set  of  affine  points  on [22m[32mcrv[0m, [22m[32mL[0m is a list of rational
  functions on [22m[32mcrv[0m.
  Output: The evaluation code associated to the points in [22m[32mpts[0m and functions in
  [22m[32mL[0m,  but  specifically  for  affine  plane curves and this function checks if
  points  are  ``bad"  (if so removes them from the list [22m[32mpts[0m automatically). A
  point  is  ``bad''  if  either  it  does  not lie on the set of non-singular
  F-rational points (places of degree 1) on the curve.
  
  Very  similar  to  [22m[32mEvaluationCode[0m  (see  [1m[34mEvaluationCode[0m  ([1m5.6-1[0m)  for a more
  general construction).
  
  [1m[4m[31m5.7-24 EvaluationBivariateCodeNC[0m
  
  [1m[34m> EvaluationBivariateCodeNC( [0m[22m[34mpts, L, crv[0m[1m[34m ) _________________________[0mfunction
  
  As in [22m[32mEvaluationBivariateCode[0m but does not check if the points are ``bad''.
  
  Input:  [22m[32mpts[0m  is  a  set  of  affine  points  on [22m[32mcrv[0m, [22m[32mL[0m is a list of rational
  functions on [22m[32mcrv[0m.
  Output: The evaluation code associated to the points in [22m[32mpts[0m and functions in
  [22m[32mL[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> q:=4;;[0m
    [22m[35mgap> F:=GF(q^2);;[0m
    [22m[35mgap> R:=PolynomialRing(F,2);;[0m
    [22m[35mgap> vars:=IndeterminatesOfPolynomialRing(R);;[0m
    [22m[35mgap> x:=vars[1];;[0m
    [22m[35mgap> y:=vars[2];;[0m
    [22m[35mgap> crv:=AffineCurve(y^q+y-x^(q+1),R);[0m
    [22m[35mrec( ring := PolynomialRing(..., [ x_1, x_2 ]), polynomial := x_1^5+x_2^4+x_2 )[0m
    [22m[35mgap> L:=[ x^0, x, x^2*y^-1 ];[0m
    [22m[35m[ Z(2)^0, x_1, x_1^2/x_2 ][0m
    [22m[35mgap> Pts:=AffinePointsOnCurve(crv.polynomial,crv.ring,F);;[0m
    [22m[35mgap> C1:=EvaluationBivariateCode(Pts,L,crv); time;[0m
    [22m[35m[0m
    [22m[35m[0m
    [22m[35m Automatically removed the following 'bad' points (either a pole or not [0m
    [22m[35m on the curve):[0m
    [22m[35m[ [ 0*Z(2), 0*Z(2) ] ][0m
    [22m[35m[0m
    [22m[35ma linear [63,3,1..60]51..59  evaluation code over GF(16)[0m
    [22m[35m52[0m
    [22m[35mgap> P:=Difference(Pts,[[ 0*Z(2^4)^0, 0*Z(2)^0 ]]);;[0m
    [22m[35mgap> C2:=EvaluationBivariateCodeNC(P,L,crv); time;[0m
    [22m[35ma linear [63,3,1..60]51..59  evaluation code over GF(16)[0m
    [22m[35m48[0m
    [22m[35mgap> C3:=EvaluationCode(P,L,R); time;[0m
    [22m[35ma linear [63,3,1..56]51..59  evaluation code over GF(16)[0m
    [22m[35m58[0m
    [22m[35mgap> MinimumDistance(C1);[0m
    [22m[35m56[0m
    [22m[35mgap> MinimumDistance(C2);[0m
    [22m[35m56[0m
    [22m[35mgap> MinimumDistance(C3);[0m
    [22m[35m56[0m
    [22m[35mgap>[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m5.7-25 OnePointAGCode[0m
  
  [1m[34m> OnePointAGCode( [0m[22m[34mf, P, m, R[0m[1m[34m ) _____________________________________[0mfunction
  
  Input:  [22m[34mf[0m  is  a  polynomial  in R=F[x,y], where [22m[34mF[0m is a finite field, [22m[34mm[0m is a
  positive  integer  (the multiplicity of the `point at infinity' infty on the
  curve f(x,y)=0), [22m[34mP[0m is a list of n points on the curve over F.
  Output: The C which is the image of the evaluation map
  
  \[
       Eval_P:L(m \cdot \infty)\rightarrow F^n,
  \]
  
  given  by flongmapsto (f(p_1),...,f(p_n)), where p_i in P. Here L(m * infty)
  denotes  the  Riemann-Roch space of the divisor m * infty on the curve. This
  has a basis consisting of monomials x^iy^j, where (i,j) range over a polygon
  depending on m and f(x,y). For more details on the Riemann-Roch space of the
  divisor m * infty see Proposition III.10.5 in Stichtenoth [S93].
  
  This command returns a "record" object [22m[32mC[0m with several extra components (type
  [22m[32mNamesOfComponents(C)[0m to see them all): [22m[32mC!.points[0m (namely [22m[34mP[0m), [22m[32mC!.multiplicity[0m
  (namely [22m[34mm[0m), [22m[32mC!.curve[0m (namely [22m[34mf[0m) and [22m[32mC!.ring[0m (namely [22m[34mR[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> F:=GF(11);[0m
    [22m[35mGF(11)[0m
    [22m[35mgap> R := PolynomialRing(F,["x","y"]);[0m
    [22m[35mPolynomialRing(..., [ x, y ])[0m
    [22m[35mgap> indets := IndeterminatesOfPolynomialRing(R);[0m
    [22m[35m[ x, y ][0m
    [22m[35mgap> x:=indets[1]; y:=indets[2];[0m
    [22m[35mx[0m
    [22m[35my[0m
    [22m[35mgap> P:=AffinePointsOnCurve(y^2-x^11+x,R,F);;[0m
    [22m[35mgap> C:=OnePointAGCode(y^2-x^11+x,P,15,R);[0m
    [22m[35ma linear [11,8,1..0]2..3  one-point AG code over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m4[0m
    [22m[35mgap> Pts:=List([1,2,4,6,7,8,9,10,11],i->P[i]);;[0m
    [22m[35mgap> C:=OnePointAGCode(y^2-x^11+x,PT,10,R);[0m
    [22m[35ma linear [9,6,1..4]2..3 one-point AG code over GF(11)[0m
    [22m[35mgap> MinimumDistance(C);[0m
    [22m[35m4[0m
  [22m[35m------------------------------------------------------------------[0m
  
  See [1m[34mEvaluationCode[0m ([1m5.6-1[0m) for a more general construction.
  
