|
| 1 | +# methods for power of primes |
| 2 | + |
1 | 3 | InstallMethod(CosetPosFunction, |
2 | 4 | "Returns cosetPos(g) function for the congruence subgroup G", |
3 | 5 | [ IsIntegerMatrixGroup and IsHAPCongruenceSubgroupGamma0 ], |
4 | 6 | function(G) |
5 | | - local cosetPos, canonicalRep, n, ProjLine; |
| 7 | + local cosetPos, canonicalRep, n, countRep; |
6 | 8 |
|
7 | 9 | if DimensionOfMatrixGroup(G) <> 2 then |
8 | 10 | TryNextMethod(); |
9 | 11 | fi; |
10 | 12 |
|
11 | 13 | n := LevelOfCongruenceSubgroup(G); |
12 | 14 |
|
13 | | - if IsPrime(n) then |
| 15 | + if not IsPrimePowerInt(n) then |
14 | 16 | TryNextMethod(); |
15 | 17 | fi; |
16 | 18 |
|
17 | | - ProjLine := FiniteProjectiveLine(n); |
| 19 | + if IsPrime(n) then |
| 20 | + TryNextMethod(); |
| 21 | + fi; |
18 | 22 |
|
19 | 23 | canonicalRep := function(g) |
20 | 24 | local v, vv, U, d, dd, x, y; |
21 | 25 | v := [g[1][1], g[2][1]]; |
22 | 26 | vv := List(v, x -> x mod n); |
23 | | - U := Units(Integers mod n); |
| 27 | + U := Filtered([0..n],i->Gcd(i,n)=1); |
| 28 | + if vv[1] mod n = 0 then |
| 29 | + return [0,1]; |
| 30 | + elif vv[1] mod n in U then |
| 31 | + return [1,(Inverse(vv[1]) mod n)*vv[2] mod n]; |
| 32 | + else |
| 33 | + d := Gcd(vv[1],n); |
| 34 | + dd := n/d; |
| 35 | + x := vv[1]/d; |
| 36 | + y := vv[2]/x mod dd; |
| 37 | + while not Gcd(d,y) = 1 do |
| 38 | + y := y + dd; |
| 39 | + od; |
| 40 | + return [d, y]; |
| 41 | + fi; |
| 42 | + end; |
| 43 | + |
| 44 | + countRep := function(m) |
| 45 | + local p, e, i, countp; |
| 46 | + |
| 47 | + p := Set(Factors(m))[1]; |
| 48 | + e := Length(Factors(m)); |
| 49 | + |
| 50 | + countp := [1,m]; |
| 51 | + |
| 52 | + for i in [2..e] do |
| 53 | + Add(countp, p^(e-i)*(p-1)); |
| 54 | + od; |
| 55 | + |
| 56 | + return countp; |
| 57 | + end; |
| 58 | + |
| 59 | + cosetPos := function(g) |
| 60 | + local w, count, e, U; |
| 61 | + w := canonicalRep(g); |
| 62 | + |
| 63 | + count := countRep(n); |
| 64 | + |
| 65 | + if w[1] = 0 then |
| 66 | + return 1; |
| 67 | + elif w[1] = 1 then |
| 68 | + U := [0..n-1]; |
| 69 | + return 1 + Position(U,w[2]); |
| 70 | + else |
| 71 | + e := Length(Factors(w[1])); |
| 72 | + U := Filtered([0..n/w[1]], i-> Gcd(i,n/w[1]) = 1); |
| 73 | + return Sum(count{[1..1 + e]}) + Position(U, w[2]); |
| 74 | + fi; |
| 75 | + end; |
| 76 | + |
| 77 | + return cosetPos; |
| 78 | + end); |
| 79 | + |
| 80 | +InstallMethod(CosetPosFunction, |
| 81 | + "Returns cosetPos(g) function for the congruence subgroup G", |
| 82 | + [ IsIntegerMatrixGroup and IsHAPCongruenceSubgroupGamma0 ], |
| 83 | + function(G) |
| 84 | + local cosetPos, canonicalRep, n, ProjLine, U; |
| 85 | + |
| 86 | + if DimensionOfMatrixGroup(G) <> 2 then |
| 87 | + TryNextMethod(); |
| 88 | + fi; |
| 89 | + |
| 90 | + n := LevelOfCongruenceSubgroup(G); |
| 91 | + |
| 92 | + if IsPrime(n) then |
| 93 | + TryNextMethod(); |
| 94 | + fi; |
| 95 | + |
| 96 | + if IsPrimePowerInt(n) then |
| 97 | + TryNextMethod(); |
| 98 | + fi; |
| 99 | + |
| 100 | + ProjLine := ProjectiveSpace(G); |
| 101 | + |
| 102 | + U := Filtered([0..n],i -> Gcd(i,n) = 1); |
| 103 | + |
| 104 | + canonicalRep := function(g) |
| 105 | + local v, vv, d, dd, x, y; |
| 106 | + v := [g[1][1], g[2][1]]; |
| 107 | + vv := List(v, x -> x mod n); |
24 | 108 | if vv[1] mod n = 0 then |
25 | 109 | return [0,1]; |
26 | | - elif ZmodnZObj(vv[1],n) in U then |
| 110 | + elif (vv[1] mod n) in U then |
27 | 111 | return [1,(Inverse(vv[1]) mod n)*vv[2] mod n]; |
28 | 112 | else |
29 | 113 | d := Gcd(vv[1],n); |
@@ -62,7 +146,7 @@ InstallMethod(CosetRepFunction, |
62 | 146 | TryNextMethod(); |
63 | 147 | fi; |
64 | 148 |
|
65 | | - ProjLine := FiniteProjectiveLine(n); |
| 149 | + ProjLine := ProjectiveSpace(G); |
66 | 150 |
|
67 | 151 | cosetOfInt := function(i) |
68 | 152 | local a, c, b, d, gg; |
@@ -106,7 +190,7 @@ InstallMethod(CosetRepFunction, |
106 | 190 | TryNextMethod(); |
107 | 191 | fi; |
108 | 192 |
|
109 | | - ProjLine := FiniteProjectiveLine(n); |
| 193 | + ProjLine := ProjectiveSpace(G); |
110 | 194 |
|
111 | 195 | GG:=AmbientGroupOfCongruenceSubgroup(G); |
112 | 196 |
|
|
0 commit comments