All my code linked to on this page is copylefted.
Example commands to start using this program:
## Examples
RequirePackage("guava");
Read("PATH/golay12.gap");
## The Golay code 12,6,6
r1 :=[0, 0, 2, 2, 1, 1, 0, 0, 1, 1, 0, 0];;
r2 :=[0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1];;
r3 :=[0, 2, 2, 0, 1, 0, 0, 1, 1, 0, 0, 1];;
r4 :=[0, 2, 0, 2, 2, 0, 2, 2, 0, 0, 0, 1];;
r5 :=[0, 0, 2, 0, 0, 1, 1, 0, 1, 0, 1, 1];;
r6 :=[1, 0, 2, 0, 2, 0, 0, 2, 0, 0, 1, 1];;
G:=[r1,r2,r3,r4,r5,r6];;
C12:=GeneratorMatCode(G,GF(3));;
wt6_codewords_wt( C12, 6);;
wt9_codewords:=codewords_wt( C12, 9);;
wt12_codewords_wt( C12, 12);;
## Examples
## decoding a random wt 12 codeword with 2 errors
c:=Random(wt12_codewords);
n1:=Random([1..12]);
n2:=Random([1..12]);
if n1=n2 and n1<12 then n2:=n1+1; fi;
if n1=n2 and n1=12 then n2:=n1-1; fi;
e:=[];
for i in [1..12] do
if i in [n1,n2] then e[i]:=1; else e[i]:=0; fi;
od;
r:=(e+c) mod 3;
decode(r);
## decoding a random wt 9 codeword with 2 errors
c:=Random(wt9_codewords);
n1:=Random([1..12]);
n2:=Random([1..12]);
if n1=n2 and n1<12 then n2:=n1+1; fi;
if n1=n2 and n1=12 then n2:=n1-1; fi;
e:=[];
for i in [1..12] do
if i in [n1,n2] then e[i]:=1; else e[i]:=0; fi;
od;
r:=(e+c) mod 3;
decode(r);
## decoding a random wt 6 codeword with 2 errors
c:=Random(wt6_codewords);
n1:=Random([1..12]);
n2:=Random([1..12]);
if n1=n2 and n1<12 then n2:=n1+1; fi;
if n1=n2 and n1=12 then n2:=n1-1; fi;
e:=[];
for i in [1..12] do
if i in [n1,n2] then e[i]:=1; else e[i]:=0; fi;
od;
r:=(e+c) mod 3;
decode(r);
composition([a1,b1,c1],[a2,b2,c2]);The algorithm used is that in D. Buell, Binary quadratic forms, Springer-Verlag, 1989.
## Examples
Read("PATH/toric.gap");
dual_semigp_gens([[1,0],[3,4]]);
J:=ideal_affine_toric_variety([[1,0],[3,4]]);
GeneratorsOfIdeal(J);
toric_points(2,GF(5));
C:=toric_code([[1,0],[3,4]],GF(3));
Display(GeneratorMat(C));
divisor_polytope([6,6,0],[[2,-1],[-1,2],[-1,-1]]);
Cones1:=[[[2,-1],[-1,2]],[[-1,2],[-1,-1]],[[-1,-1],[2,-1]]];Div:=[6,6,0];
Rays1:=[[2,-1],[-1,2],[-1,-1]];
riemann_roch(Div,Rays1);
P_Div:=divisor_polytope_lattice_points(Div,Rays1);
Cones2:=[ [ [2,0,0],[0,2,0],[0,0,2] ], [ [2,0,0],[0,2,0],[2,-2,1],[1,2,-2] ] ];
faces(Cones2[1]);
faces(Cones2[2]);
number_of_cones_dim(Cones2,1);
number_of_cones_dim(Cones2,2);
number_of_cones_dim(Cones2,3);
star([[1,0]],Cones2);
Cones3:=[ [ [2,0,0],[0,2,0],[0,0,2] ], [ [2,0,0],[0,2,0],[1,1,-2] ] ];
star([[2,0,0],[0,2,0]],Cones3);
subcones_of_fan(Cones2,1);
subcones_of_fan(Cones3,2);
betti_number(Cones1,1);
cardinality_of_X(Cones1,3);
euler_characteristic(Cones1);
See the paper with H. Verrill for more details.
## Example
Read("PATH//poly2finite_field.gap");
x:=X(GF(9),"x");
f:=x^7+x^3+x+1;
DefaultField(CoefficientsOfUnivariatePolynomial(f));
as:=RootsOfUPol(GF(3^7),f);
a:=Minimum(as);
pol:=x^2+x+1;
Value(pol,a);
HomToFF(pol,f);
##Example n:=NextPrimeInt(10000);; a:=PrimitiveRootMod(n);; b:=Random([2..n-1]);; x:=DL_shanks(a,b,n);; b=a^x mod n; # trueOther examples are given in the *.gap file.
Last updated 12-20-2004.
This page is at the url: http://www.usna.edu/Users/math/wdj/gap/gap_stuff.html