1#############################################################################
2##
3#W  perlist.tst                GAP4 Package `RCWA'                Stefan Kohl
4##
5##  This file contains automated tests of RCWA's functionality for computing
6##  with periodic lists. The periodic lists themselves are implemented in the
7##  FR package of Laurent Bartholdi.
8##
9#############################################################################
10
11gap> START_TEST( "perlist.tst" );
12gap> RCWADoThingsToBeDoneBeforeTest();
13gap> ct := ClassTransposition(0,3,2,3);
14( 0(3), 2(3) )
15gap> l := PeriodicList([],[0..11]);
16[/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
17gap> Permuted(l,ct);
18[/ 2, 1, 0, 5, 4, 3, 8, 7, 6, 11, 10, 9 ]
19gap> l := PeriodicList([17],[0..11]);
20[ 17, / 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
21gap> Permuted(l,ct);
22[ 1, 0, 17, / 4, 3, 2, 7, 6, 5, 10, 9, 8, 1, 0, 11 ]
23gap> l := PeriodicList([17,23,45,47],[0..11]);
24[ 17, 23, 45, 47, / 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
25gap> Permuted(l,ct);
26[ 45, 23, 17, 1, 0, 47, / 4, 3, 2, 7, 6, 5, 10, 9, 8, 1, 0, 11 ]
27gap> l := PeriodicList([17,23,45,47],[0..10]);
28[ 17, 23, 45, 47, / 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
29gap> Permuted(l,ct);
30[ 45, 23, 17, 1, 0, 47, / 4, 3, 2, 7, 6, 5, 10, 9, 8, 2, 1, 0, 5, 4, 3, 8, 7, \
316, 0, 10, 9, 3, 2, 1, 6, 5, 4, 9, 8, 7, 1, 0, 10 ]
32gap> T := RcwaMapping([[1,0,2],[3,1,2]]);;
33gap> l := PeriodicList([0],[1,2]);
34[ 0, / 1, 2 ]
35gap> Permuted(Permuted(l,T),T) = Permuted(l,T^2);
36true
37gap> IsSubset([0..2],l);
38true
39gap> IsSubset([0..1],l);
40false
41gap> IsSubset(NonnegativeIntegers,l);
42true
43gap> IsSubset(Integers,l);
44true
45gap> Sum(l);
46infinity
47gap> Sum(PeriodicList([],[-1,1]));
48fail
49gap> Sum(PeriodicList([1,2],[0]));
503
51gap> Product(PeriodicList([],[-1,1]));
52fail
53gap> Product(PeriodicList([],[1]));
541
55gap> Product(PeriodicList([],[-1]));
56fail
57gap> Product(PeriodicList([],[2]));
58infinity
59gap> -l;
60[ 0, / -1, -2 ]
61gap> l1 := PeriodicList([1,2],[0..4]);
62[ 1, 2, / 0, 1, 2, 3, 4 ]
63gap> l2 := PeriodicList([1,2,3],[0..3]);
64[ 1, 2, 3, / 0, 1, 2, 3 ]
65gap> l1+l2;
66[ 2, 4, / 3, 1, 3, 5, 7, 0, 2, 4, 6, 4, 1, 3, 5, 3, 5, 2, 4, 2, 4, 6 ]
67gap> 1+l;
68[ 1, / 2, 3 ]
69gap> l-1;
70[ -1, / 0, 1 ]
71gap> 2*l;
72[ 0, / 2, 4 ]
73gap> l*3;
74[ 0, / 3, 6 ]
75gap> (l*3)/3 = l;
76true
77gap> l := PeriodicList([],[1,2]);
78[/ 1, 2 ]
79gap> Sum(l);
80infinity
81gap> Product(l);
82infinity
83gap> l := PeriodicList([0],[1,2]);
84[ 0, / 1, 2 ]
85gap> Sum(l);
86infinity
87gap> Product(l);
880
89gap> l := PeriodicList([1,2,3],[1,2,0]);
90[ 1, 2, 3, / 1, 2, 0 ]
91gap> Sum(l);
92infinity
93gap> Product(l);
940
95gap> l := PeriodicList([0],[0]);
96[ 0, / 0 ]
97gap> Sum(l);
980
99gap> Product(l);
1000
101gap> l := PeriodicList([-1],[1]);
102[ -1, / 1 ]
103gap> Sum(l);
104infinity
105gap> Product(l);
106-1
107gap> l := PeriodicList([-1],[-1]);
108[ -1, / -1 ]
109gap> Product(l);
110fail
111gap> l := PeriodicList([-1],[1,-1]);
112[ -1, / 1, -1 ]
113gap> Sum(l);
114fail
115gap> Product(l);
116fail
117gap> l := PeriodicList([],[1,-1,0]);
118[/ 1, -1, 0 ]
119gap> Sum(l);
120fail
121gap> Product(l);
1220
123gap> l := PeriodicList([-1],[1,-1,0]);
124[ -1, / 1, -1, 0 ]
125gap> Sum(l);
126fail
127gap> Product(l);
1280
129gap> l1 := PeriodicList([1,2,3],[1,2]);
130[ 1, 2, 3, / 1, 2 ]
131gap> l2 := PeriodicList([1,2,3,4],[1,2,3]);
132[ 1, 2, 3, 4, / 1, 2, 3 ]
133gap> -l1;
134[ -1, -2, -3, / -1, -2 ]
135gap> l1+l2;
136[ 2, 4, 6, 5, / 3, 3, 5, 2, 4, 4 ]
137gap> last-l1;
138[ 1, 2, 3, 4, / 1, 2, 3 ]
139gap> 2*l1;
140[ 2, 4, 6, / 2, 4 ]
141gap> 2*l1-l1*2;
142[/ 0 ]
143gap> (2*l1)/2;
144[ 1, 2, 3, / 1, 2 ]
145gap> l1+1;
146[ 2, 3, 4, / 2, 3 ]
147gap> 3+l1;
148[ 4, 5, 6, / 4, 5 ]
149gap> 1-l1;
150[ 0, -1, -2, / 0, -1 ]
151gap> T := RcwaMapping([[1,0,2],[3,1,2]]);
152<rcwa mapping of Z with modulus 2>
153gap> l := PeriodicList([],[1]);
154[/ 1 ]
155gap> Permuted(l,T);
156[/ 1, 1, 2 ]
157gap> Permuted(last,T);
158[/ 1, 2, 2, 1, 2, 2, 1, 2, 3 ]
159gap> Permuted(last,T);
160[/ 1, 2, 4, 1, 3, 3, 1, 2, 4, 1, 2, 4, 1, 3, 3, 1, 2, 4, 1, 2, 4, 1, 3, 3, 1, \
1612, 5 ]
162gap> Sum(Period(last));
16364
164gap> G := WreathProduct(Group(ClassTransposition(0,2,1,2)),
165>                       Group(ClassShift(0,1)));
166<wild rcwa group over Z with 2 generators>
167gap> IsSubgroup(CT(Integers),G);
168true
169gap> StructureDescription(G);
170"C2 wr Z"
171gap> l := PeriodicList([],[1,2]);
172[/ 1, 2 ]
173gap> Ball(G,l,3,Permuted:Spheres);
174[ [ [/ 1, 2 ] ], [ [/ 1, 2, 1, 1 ], [/ 1, 2, 2, 2 ] ],
175  [ [/ 1, 2, 1, 1, 1, 1, 1, 1 ], [/ 1, 2, 2, 2, 2, 2, 2, 2 ] ],
176  [ [/ 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],
177      [/ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ] ] ]
178gap> List([1..6],k->Length(Ball(G,l,k,Permuted)));
179[ 3, 5, 7, 9, 11, 13 ]
180gap> l := PeriodicList([],[1,2,3]);
181[/ 1, 2, 3 ]
182gap> List([1..6],k->Length(Ball(G,l,k,Permuted)));
183[ 4, 10, 22, 44, 84, 155 ]
184gap> l := PeriodicList([],[1..8]);
185[/ 1, 2, 3, 4, 5, 6, 7, 8 ]
186gap> List([1..6],k->Length(Ball(G,l,k,Permuted)));
187[ 4, 9, 16, 24, 32, 40 ]
188gap> l := PeriodicList([],[1..16]);
189[/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 ]
190gap> List([1..5],k->Length(Ball(G,l,k,Permuted)));
191[ 4, 10, 21, 37, 58 ]
192gap> RCWADoThingsToBeDoneAfterTest();
193gap> STOP_TEST( "perlist.tst", 560000000 );
194
195#############################################################################
196##
197#E  perlist.tst . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
198