Skip to content

Commit

Permalink
added tests specifically for traces on the newsubspace
Browse files Browse the repository at this point in the history
  • Loading branch information
assaferan committed Jun 22, 2023
1 parent 0e416b4 commit f083c67
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ m4
Makefile
configure
ltmain.sh
*.sig
Tests/*.sig
26 changes: 21 additions & 5 deletions Tests/MagmaFormula.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import "magma_functions.m" : TraceFormulaGamma0AL;
import "magma_functions.m" : TraceFormulaGamma0AL, TraceFormulaGamma0ALNew;

procedure testPariVSMagma(N,k)
cmd := Sprintf("./src/traceALbatch_sta %o %o %o", N, N+1, k);
procedure testPariVSMagma(N,k : New := false, OnlyPrimes := false, Prec := 1000)
if (New and (not OnlyPrimes)) then
printf("Error! Only supports newsubspace for prime Hecke operators!\n");
assert false;
end if;
cmd := Sprintf("./src/traceALbatch_sta %o %o %o %o %o %o", N, N+1, k, Prec, OnlyPrimes, New);
System(cmd);
fname := Sprintf("./data/traces_%o_%o.m", k, N);
r := Read(fname);
Expand All @@ -11,8 +15,10 @@ procedure testPariVSMagma(N,k)
fin := Index(r, "]") - 1;
r := r[start..fin];
traces_AL := [StringToInteger(x) : x in Split(r, ",")];
traces_magma := [TraceFormulaGamma0AL(n, N, k) : n in [1..1000]];
assert traces_magma eq traces_AL[2..1001];
trace_func := New select TraceFormulaGamma0ALNew else TraceFormulaGamma0AL;
val_list := OnlyPrimes select PrimesUpTo(Prec) else [0..Prec];
traces_magma := [trace_func(n, N, k) : n in val_list];
assert traces_magma eq traces_AL[1..#val_list];
return;
end procedure;

Expand All @@ -29,5 +35,15 @@ procedure testPariVSMagma(N,k)
printf "(%o;%o),", N, k;
testPariVSMagma(N,k);
end for;

printf "testing pari vs magma implementation on new subspaces... (N;k) = ";
for i in [1..num_tests] do
N := Random(Ns);
max_weight := Floor(Sqrt(max_Nk2/N));
ks := [2..max_weight by 2];
k := Random(ks);
printf "(%o;%o),", N, k;
testPariVSMagma(N,k : New, OnlyPrimes);
end for;
printf "\n";

49 changes: 42 additions & 7 deletions Tests/ModSym.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
// SetDebugOnError(true);
// SetVerbose("ModularSymbols", 3);

procedure testPariVSMS(N,k,n)
cmd := Sprintf("./src/traceALbatch_sta %o %o %o", N, N+1, k);
import "magma_functions.m" : get_trace;

procedure testPariVSMS(N,k,n : New := false)
is_prime := IsPrime(n);
if (is_prime) then
n_idx := #PrimesUpTo(n);
else
if (New) then
printf("Error! Only supports newsubspace for prime Hecke operators!\n");
assert false;
end if;
n_idx := n + 1;
end if;
cmd := Sprintf("./src/traceALbatch_sta %o %o %o %o %o %o", N, N+1, k, n, is_prime, New);
System(cmd);
fname := Sprintf("./data/traces_%o_%o.m", k, N);
r := Read(fname);
Expand All @@ -12,10 +24,10 @@ procedure testPariVSMS(N,k,n)
fin := Index(r, "]") - 1;
r := r[start..fin];
traces_AL := [StringToInteger(x) : x in Split(r, ",")];
C := CuspidalSubspace(ModularSymbols(N,k,1));
al := AtkinLehner(C,N);
T := HeckeOperator(C,n);
assert traces_AL[n+1] eq Trace(al*T);
// C := CuspidalSubspace(ModularSymbols(N,k,1));
// al := AtkinLehner(C,N);
// T := HeckeOperator(C,n);
assert traces_AL[n_idx] eq get_trace(N,k,n : New := New); // Trace(al*T);
return;
end procedure;

Expand All @@ -29,8 +41,31 @@ procedure testPariVSMS(N,k,n)
max_weight := Floor(Sqrt(max_Nk2/N));
ks := [2..max_weight by 2];
k := Random(ks);
n := Random([1..1000]);
n := Random([1..N]);
printf "(%o;%o;%o),", N, k, n;
testPariVSMS(N,k,n);
end for;

printf "testing trace on new subspace... (N;k;p) = ";
for i in [1..num_tests] do
N := Random(Ns);
max_weight := Floor(Sqrt(max_Nk2/N));
ks := [2..max_weight by 2];
k := Random(ks);
p := Random(PrimesUpTo(N));
printf "(%o;%o;%o),", N, k, p;
testPariVSMS(N,k,p : New);
end for;

printf "testing trace on new subspace for bad primes... (N;k;p) = ";
for i in [1..num_tests] do
N := Random(Ns);
max_weight := Floor(Sqrt(max_Nk2/N));
ks := [2..max_weight by 2];
k := Random(ks);
p := Random(PrimesDivisors(N));
printf "(%o;%o;%o),", N, k, p;
testPariVSMS(N,k,p : New);
end for;

printf "\n";
1 change: 1 addition & 0 deletions magma_functions.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function alpha(n)
// Theorem 4.
// (Also appears in Skoruppa-Zagier, but this way of stating the formula was easier to work with).
function TraceFormulaGamma0AL(n, N, k)
if (n eq 0) return 0; // for compatibility with q-expansions
S1 := 0;
// max_abst := Floor(SquareRoot(4*N*n));
max_abst := Floor(SquareRoot(4*N*n)) div N;
Expand Down

0 comments on commit f083c67

Please sign in to comment.