Skip to content

Commit

Permalink
Version 0.2 - applied all initial feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
BNasmith committed Feb 4, 2024
1 parent a3435da commit 89c5b8a
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 334 deletions.
4 changes: 2 additions & 2 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SetPackageInfo( rec(

PackageName := "ALCO",
Subtitle := "Tools for algebraic combinatorics",
Version := "0.1",
Date := "15/01/2024", # dd/mm/yyyy format
Version := "0.2",
Date := "04/02/2024", # dd/mm/yyyy format
License := "GPL-3.0-or-later",

PackageWWWHome := "https://github.com/BNasmith/alco",
Expand Down
454 changes: 219 additions & 235 deletions doc/ALCO.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/alco.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ DeclareGlobalFunction( "GoldenIrrationalComponent" );

DeclareGlobalFunction( "GoldenModSigma" );

DeclareGlobalVariable( "IcosianH4Basis" );
DeclareGlobalVariable( "IcosianH4Generators" );

DeclareOperation("IsIcosian", [ IsQuaternion ] );

Expand Down
8 changes: 4 additions & 4 deletions lib/alco.gi
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ InstallGlobalFunction( GoldenModSigma, function(q)
return Coefficients(Basis(NF(5,[1,4]), [1, (1-Sqrt(5))/2]), q)[1];
end );

InstallValue( IcosianH4Basis, Basis(QuaternionAlgebra(Field(Sqrt(5))),
InstallValue( IcosianH4Generators, Basis(QuaternionAlgebra(Field(Sqrt(5))),
List([ [ 0, -1, 0, 0 ],
[ 0, -1/2*E(5)^2-1/2*E(5)^3, 1/2, -1/2*E(5)-1/2*E(5)^4 ],
[ 0, 0, -1, 0 ],
Expand All @@ -263,8 +263,8 @@ SetName( IcosianRing, "IcosianRing" );
SetString( IcosianRing, "IcosianRing" );
SetIsLeftActedOnByDivisionRing( IcosianRing, false );
SetSize( IcosianRing, infinity );
SetGeneratorsOfRing( IcosianRing, AsList(IcosianH4Basis));
SetGeneratorsOfLeftModule( IcosianRing, AsList(IcosianH4Basis) );
SetGeneratorsOfRing( IcosianRing, AsList(IcosianH4Generators));
SetGeneratorsOfLeftModule( IcosianRing, AsList(IcosianH4Generators) );
SetIsWholeFamily( IcosianRing, false );
SetIsAssociative( IcosianRing, false );

Expand Down Expand Up @@ -310,7 +310,7 @@ InstallMethod( CanonicalBasis,
rec() );
SetUnderlyingLeftModule( B, IcosianRing );
SetIsIntegralBasis( B, true );
SetBasisVectors( B, Immutable( BasisVectors(IcosianH4Basis)));
SetBasisVectors( B, Immutable( BasisVectors(IcosianH4Generators)));
# Return the basis.
return B;
end );
Expand Down
2 changes: 2 additions & 0 deletions makedoc.g
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ AutoDoc(rec(
));

# Test("./tst/alco06.tst", rec(transformFunction := NormalizedWhitespace));

FORCE_QUIT_GAP();
8 changes: 4 additions & 4 deletions tst/alco01.tst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gap> Display(g);
gap> IsGossetLatticeGramMatrix(g);
true

# doc/ALCO.xml:45-55
# doc/ALCO.xml:46-56
gap> short := Set(ShortestVectors(g,4).vectors, y ->
> LinearCombination(Basis(OctavianIntegers), y));;
gap> s := First(short, x -> x^2 + x + 2*One(x) = Zero(x));
Expand All @@ -40,7 +40,7 @@ gap> L := OctonionLatticeByGenerators(gens, One(O)*IdentityMat(3)/2);
gap> IsLeechLatticeGramMatrix(GramMatrix(L));
true

# doc/ALCO.xml:55-78
# doc/ALCO.xml:56-79
gap> J := AlbertAlgebra(Rationals);
<algebra-with-one of dimension 27 over Rationals>
gap> SemiSimpleType(Derivations(Basis(J)));
Expand All @@ -53,8 +53,8 @@ gap> k := Basis(J){[17..24]};
[ k1, k2, k3, k4, k5, k6, k7, k8 ]
gap> e := Basis(J){[25..27]};
[ ei, ej, ek ]
gap> List(e, IsIdempotent);
[ true, true, true ]
gap> ForAll(e, IsIdempotent);
true
gap> Set(i, x -> x^2);
[ ej+ek ]
gap> Set(j, x -> x^2);
Expand Down
45 changes: 22 additions & 23 deletions tst/alco02.tst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
gap> START_TEST("alco02.tst");

# doc/ALCO.xml:137-154
# doc/ALCO.xml:140-157
gap> O := OctonionAlgebra(Rationals);
<algebra-with-one of dimension 8 over Rationals>
gap> LeftActingDomain(O);
Expand All @@ -30,7 +30,7 @@ gap> Derivations(Basis(O));
gap> SemiSimpleType(last);
"G2"

# doc/ALCO.xml:167-180
# doc/ALCO.xml:171-184
gap> a := BasisVectors(Basis(OctavianIntegers));;
gap> for x in a do Display(x); od;
(-1/2)*e1+(1/2)*e5+(1/2)*e6+(1/2)*e7
Expand All @@ -46,44 +46,43 @@ true
gap> ForAll(a/2, IsOctavianInt);
false

# doc/ALCO.xml:190-196
# doc/ALCO.xml:195-200
gap> BasisVectors(OctonionE8Basis) = BasisVectors(Basis(OctavianIntegers));
true
gap> g := List(OctonionE8Basis, x ->
> List(OctonionE8Basis, y ->
gap> g := List(OctonionE8Basis, x -> List(OctonionE8Basis, y ->
> Norm(x+y) - Norm(x) - Norm(y)));;
gap> IsGossetLatticeGramMatrix(g);
true

# doc/ALCO.xml:230-235
# doc/ALCO.xml:218-223
gap> Oct := OctonionAlgebra(Rationals);;
gap> List(Basis(Oct), Norm);
[ 1, 1, 1, 1, 1, 1, 1, 1 ]
gap> x := Random(Oct);; y := Random(Oct);;
gap> Norm(x*y) = Norm(x)*Norm(y);
true

# doc/ALCO.xml:244-249
# doc/ALCO.xml:236-241
gap> e := BasisVectors(Basis(OctonionAlgebra(Rationals)));
[ e1, e2, e3, e4, e5, e6, e7, e8 ]
gap> List(e, Trace);
[ 0, 0, 0, 0, 0, 0, 0, 2 ]
gap> List(e, RealPart);
[ 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, e8 ]

# doc/ALCO.xml:258-261
# doc/ALCO.xml:250-253
gap> e := BasisVectors(Basis(OctonionAlgebra(Rationals)));
[ e1, e2, e3, e4, e5, e6, e7, e8 ]
gap> List(e, ComplexConjugate);
[ (-1)*e1, (-1)*e2, (-1)*e3, (-1)*e4, (-1)*e5, (-1)*e6, (-1)*e7, e8 ]

# doc/ALCO.xml:269-272
# doc/ALCO.xml:261-264
gap> e := BasisVectors(Basis(OctonionAlgebra(Rationals)));
[ e1, e2, e3, e4, e5, e6, e7, e8 ]
gap> List(e, RealPart);
[ 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, 0*e1, e8 ]

# doc/ALCO.xml:292-301
# doc/ALCO.xml:284-293
gap> O := UnderlyingLeftModule(OctonionE8Basis);
<algebra-with-one of dimension 8 over Rationals>
gap> BasisVectors(CanonicalBasis(O));
Expand All @@ -95,7 +94,7 @@ gap> y := OctonionToRealVector(CanonicalBasis(O), x);
gap> RealToOctonionVector(CanonicalBasis(O), y);
[ (-1)*e1+e5+e6+e7, (-1)*e1+(-1)*e2+(-1)*e4+(-1)*e7 ]

# doc/ALCO.xml:310-318
# doc/ALCO.xml:304-312
gap> Oct := OctonionAlgebra(Rationals);;
gap> x := Basis(Oct){[8,1,2]};
[ e8, e1, e2 ]
Expand All @@ -106,11 +105,11 @@ gap> y := VectorToIdempotentMatrix(x);; Display(y);
gap> IsIdempotent(y);
true

# doc/ALCO.xml:330-331
# doc/ALCO.xml:324-325
gap> WeylReflection([1,0,1],[0,1,1]);
[ -1, 1, 0 ]

# doc/ALCO.xml:341-360
# doc/ALCO.xml:335-354
gap> H := QuaternionAlgebra(Rationals);
<algebra-with-one of dimension 4 over Rationals>
gap> IsQuaternion(Random(H));
Expand All @@ -132,7 +131,7 @@ gap> List(b, RealPart);
gap> List(b, ImaginaryPart);
[ 0*e, e, k, (-1)*j ]

# doc/ALCO.xml:367-374
# doc/ALCO.xml:363-370
gap> H := QuaternionAlgebra(Rationals);;
gap> b := BasisVectors(CanonicalBasis(H));
[ e, i, j, k ]
Expand All @@ -142,14 +141,14 @@ gap> x := Random(H);; y := Random(H);;
gap> Norm(x*y) = Norm(x)*Norm(y);
true

# doc/ALCO.xml:382-386
# doc/ALCO.xml:379-383
gap> H := QuaternionAlgebra(Rationals);;
gap> b := BasisVectors(CanonicalBasis(H));
[ e, i, j, k ]
gap> List(b, Trace);
[ 2, 0, 0, 0 ]

# doc/ALCO.xml:450-459
# doc/ALCO.xml:397-406
gap> f := BasisVectors(Basis(HurwitzIntegers));;
gap> for x in f do Display(x); od;
(-1/2)*e+(-1/2)*i+(-1/2)*j+(1/2)*k
Expand All @@ -161,15 +160,15 @@ true
gap> ForAll(f/2, IsHurwitzInt);
false

# doc/ALCO.xml:469-474
# doc/ALCO.xml:416-421
gap> B := QuaternionD4Basis;;
gap> for x in BasisVectors(B) do Display(x); od;
(-1/2)*e+(-1/2)*i+(-1/2)*j+(1/2)*k
(-1/2)*e+(-1/2)*i+(1/2)*j+(-1/2)*k
(-1/2)*e+(1/2)*i+(-1/2)*j+(-1/2)*k
e

# doc/ALCO.xml:526-543
# doc/ALCO.xml:452-469
gap> f := BasisVectors(Basis(IcosianRing));;
gap> for x in f do Display(x); od;
(-1)*i
Expand All @@ -189,15 +188,15 @@ true
gap> ForAll(f*(1+Sqrt(5))/2, IsIcosian);
true

# doc/ALCO.xml:553-558
gap> f := BasisVectors(IcosianH4Basis);;
# doc/ALCO.xml:479-484
gap> f := BasisVectors(IcosianH4Generators);;
gap> for x in f do Display(x); od;
(-1)*i
(-1/2*E(5)^2-1/2*E(5)^3)*i+(1/2)*j+(-1/2*E(5)-1/2*E(5)^4)*k
(-1)*j
(-1/2*E(5)-1/2*E(5)^4)*e+(1/2)*j+(-1/2*E(5)^2-1/2*E(5)^3)*k

# doc/ALCO.xml:566-572
# doc/ALCO.xml:494-500
gap> sigma := (1-Sqrt(5))/2;; tau := (1+Sqrt(5))/2;;
gap> x := 5 + 3*sigma;; GoldenModSigma(x);
5
Expand All @@ -206,15 +205,15 @@ gap> GoldenModSigma(sigma);
gap> GoldenModSigma(tau);
1

# doc/ALCO.xml:591-596
# doc/ALCO.xml:521-526
gap> f := BasisVectors(Basis(EisensteinIntegers));
[ 1, E(3) ]
gap> IsEisenInt(E(4));
false
gap> IsEisenInt(1+E(3)^2);
true

# doc/ALCO.xml:606-611
# doc/ALCO.xml:538-543
gap> f := BasisVectors(Basis(KleinianIntegers));
[ 1, E(7)+E(7)^2+E(7)^4 ]
gap> IsKleinInt(E(4));
Expand Down
33 changes: 18 additions & 15 deletions tst/alco03.tst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
gap> START_TEST("alco03.tst");

# doc/ALCO.xml:713-727
# doc/ALCO.xml:657-671
gap> J := AlbertAlgebra(Rationals);;
gap> x := Sum(Basis(J){[4,5,6,25,26,27]});
i4+i5+i6+ei+ej+ek
Expand All @@ -27,13 +27,13 @@ gap> Determinant(x);
gap> Norm(x);
9/2

# doc/ALCO.xml:758-761
# doc/ALCO.xml:716-719
gap> J := SimpleEuclideanJordanAlgebra(3,8);
<algebra-with-one of dimension 27 over Rationals>
gap> Derivations(Basis(J));; SemiSimpleType(last);
"F4"

# doc/ALCO.xml:770-787
# doc/ALCO.xml:729-746
gap> J := JordanSpinFactor(IdentityMat(8));
<algebra-with-one of dimension 9 over Rationals>
gap> One(J);
Expand All @@ -53,13 +53,13 @@ gap> p := GenericMinimalPolynomial(x);
gap> ValuePol(p,x);
0*v.1

# doc/ALCO.xml:794-797
# doc/ALCO.xml:754-757
gap> J := HermitianSimpleJordanAlgebra(3,QuaternionD4Basis);
<algebra-with-one of dimension 15 over Rationals>
gap> [JordanRank(J), JordanDegree(J)];
[ 3, 4 ]

# doc/ALCO.xml:813-824
# doc/ALCO.xml:775-786
gap> J := SimpleEuclideanJordanAlgebra(2,7);
<algebra-with-one of dimension 9 over Rationals>
gap> u := Sum(Basis(J){[1,2,7,8]});
Expand All @@ -73,7 +73,7 @@ gap> H := JordanHomotope(J, u, "w.");
gap> One(H);
(-1/2)*w.1+(1/2)*w.2+(1/2)*w.7+(1/2)*w.8

# doc/ALCO.xml:848-858
# doc/ALCO.xml:813-823
gap> A := AlbertAlgebra(Rationals);
<algebra-with-one of dimension 27 over Rationals>
gap> i := Basis(A){[1..8]};;
Expand All @@ -86,7 +86,7 @@ gap> Display(i); Display(j); Display(k); Display(e);
[ k1, k2, k3, k4, k5, k6, k7, k8 ]
[ ei, ej, ek ]

# doc/ALCO.xml:872-879
# doc/ALCO.xml:838-845
gap> j := Basis(AlbertAlgebra(Rationals)){[9..16]};
[ j1, j2, j3, j4, j5, j6, j7, j8 ]
gap> mat := AlbertVectorToHermitianMatrix(j[3]);; Display(mat);
Expand All @@ -96,7 +96,7 @@ gap> mat := AlbertVectorToHermitianMatrix(j[3]);; Display(mat);
gap> HermitianMatrixToAlbertVector(mat);
j3

# doc/ALCO.xml:899-917
# doc/ALCO.xml:866-886
gap> J := JordanSpinFactor(IdentityMat(3));
<algebra-with-one of dimension 4 over Rationals>
gap> x := [-1,4/3,-1,1]*Basis(J);
Expand All @@ -110,14 +110,16 @@ gap> JordanQuadraticOperator(x);; Display(last);
[ -8/3, 7/9, -8/3, 8/3 ],
[ 2, -8/3, -7/9, -2 ],
[ -2, 8/3, -2, -7/9 ] ]
gap> LinearCombination(Basis(J), JordanQuadraticOperator(x)*ExtRepOfObj(y)) = JordanQuadraticOperator(x,y);
gap> LinearCombination(Basis(J), JordanQuadraticOperator(x)
> *ExtRepOfObj(y)) = JordanQuadraticOperator(x,y);
true
gap> ExtRepOfObj(JordanQuadraticOperator(x,y)) = JordanQuadraticOperator(x)*ExtRepOfObj(y);
gap> ExtRepOfObj(JordanQuadraticOperator(x,y)) =
> JordanQuadraticOperator(x)*ExtRepOfObj(y);
true
gap> JordanQuadraticOperator(2*x) = 4*JordanQuadraticOperator(x);
true

# doc/ALCO.xml:929-946
# doc/ALCO.xml:899-916
gap> J := AlbertAlgebra(Rationals);
<algebra-with-one of dimension 27 over Rationals>
gap> i := Basis(J){[1..8]};
Expand All @@ -137,7 +139,7 @@ gap> List(k, x -> 2*JordanTripleSystem(i[1],i[1],x));
gap> List(e, x -> JordanTripleSystem(i[1],i[1],x));
[ 0*i1, ej, ek ]

# doc/ALCO.xml:961-976
# doc/ALCO.xml:931-946
gap> H := QuaternionAlgebra(Rationals);;
gap> for x in HermitianJordanAlgebraBasis(2, Basis(H)) do Display(x); od;
[ [ e, 0*e ],
Expand All @@ -155,7 +157,7 @@ gap> for x in HermitianJordanAlgebraBasis(2, Basis(H)) do Display(x); od;
gap> AsList(Basis(H));
[ e, i, j, k ]

# doc/ALCO.xml:993-1012
# doc/ALCO.xml:963-982
gap> H := QuaternionAlgebra(Rationals);;
gap> J := HermitianSimpleJordanAlgebra(2,Basis(H));
<algebra-with-one of dimension 6 over Rationals>
Expand All @@ -177,10 +179,11 @@ gap> JordanMatrixBasis(J);; for x in last do Display(x); od;
gap> List(JordanMatrixBasis(J), x -> HermitianMatrixToJordanVector(x, J));
[ v.1, v.2, v.3, v.4, v.5, v.6 ]

# doc/ALCO.xml:1019-1024
# doc/ALCO.xml:990-996
gap> J := HermitianSimpleJordanAlgebra(2,OctonionE8Basis);
<algebra-with-one of dimension 10 over Rationals>
gap> List(Basis(J), x -> List(Basis(J), y -> Trace(x*y))) = JordanAlgebraGramMatrix(J);
gap> List(Basis(J), x -> List(Basis(J), y -> Trace(x*y))) =
> JordanAlgebraGramMatrix(J);
true
gap> DiagonalOfMat(JordanAlgebraGramMatrix(J));
[ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 ]
Expand Down
Loading

0 comments on commit 89c5b8a

Please sign in to comment.