Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241818 views
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include "smalljac.h"
4
5
/*
6
Copyright 2007 Andrew V. Sutherland
7
8
This file is part of smalljac.
9
10
smalljac is free software: you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation, either version 2 of the License, or
13
(at your option) any later version.
14
15
smalljac is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with smalljac. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
// simple command-line program to compute the L-polynomial of a J(C/F_p)
25
26
int main (int argc, char *argv[])
27
{
28
unsigned long p, N;
29
long m[8];
30
int i, n;
31
32
if ( argc < 3 ) { puts ("jgroup curve p"); puts (" \"jgroup [1,2,3,4,5] 65537\"\n \"jgroup x^5+3x^2-1 1000003\""); return 0; }
33
34
p = atol(argv[2]);
35
36
n = smalljac_group (m, argv[1], p, SMALLJAC_SGROUP);
37
if ( n <= 0 ) {
38
switch (n) {
39
case 0: printf ("Specified curve has bad reduction at %lu\n", p); break;
40
case SMALLJAC_PARSE_ERROR: printf ("Unable to parse curve string: %s\n", argv[3]); break;
41
case SMALLJAC_UNSUPPORTED_CURVE: puts ("Specified curve not supported - should be degree 3, 5, or 7\n"); break;
42
case SMALLJAC_SINGULAR_CURVE: puts ("Specified curve is singular over Q\n"); break;
43
case SMALLJAC_INVALID_PP: puts ("p must be prime"); break;
44
case SMALLJAC_WRONG_GENUS: printf ("Specified curve has the wrong genus, compiled for genus %d\n", SMALLJAC_GENUS); break;
45
default: printf ("smalljac_group returned error %d\n", n);
46
}
47
return 0;
48
}
49
printf ("J(C/F_p) is isomorphic to ");
50
for ( i = 0 ; i < n ; i++ ) if ( i ) printf (" x Z_%lu", m[i]); else printf ("Z_%lu", m[i]);
51
puts ("");
52
if ( n > 1 ) {
53
for ( i = 1, N = m[0] ; i < n ; i++ ) N *= m[i];
54
printf ("Group order is %lu\n", N);
55
}
56
}
57
58