-
Notifications
You must be signed in to change notification settings - Fork 1
/
point_funcs.m
38 lines (28 loc) · 899 Bytes
/
point_funcs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function ConvertPointToIntSeq(pt)
dim := #Eltseq(pt) -1 ;
pt_seq := [pt[i]*d where d := LCM([Denominator(pt[j]) : j in [1..dim+1]]): i in [1..dim+1]];
pt_seq := ChangeUniverse(pt_seq, Integers());
return pt_seq;
end function;
function ReducePointModp(pt, p)
C := Curve(pt);
Cp := ReduceCurveModp(C, p);
pt_seq := ConvertPointToIntSeq(pt);
pt_mod_p := Cp ! pt_seq;
return pt_mod_p;
end function;
function ReducePointsModp(pts, p)
assert #pts ge 1;
assert IsPrime(p);
C := Curve(pts[1]);
Cp := ReduceCurveModp(C, p);
pts_mod_p := [Cp ! ConvertPointToIntSeq(pt) : pt in pts];
return pts_mod_p;
end function;
procedure PrintPoints(pts)
pts_seq := [ConvertPointToIntSeq(pt) : pt in pts];
print "the points found are: \n";
for i in [1..#pts_seq] do
printf "P_%o = %o\n", i , pts_seq[i];
end for;
end procedure;