File: h1clist.cc

package info (click to toggle)
eclib 20190909-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,196 kB
  • sloc: cpp: 47,090; makefile: 251; sh: 122
file content (146 lines) | stat: -rw-r--r-- 4,584 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//   h1clist.cc  --  Outputs table of curves computing a_i, r, |T|
//////////////////////////////////////////////////////////////////////////
//
// Copyright 1990-2012 John Cremona
//
// This file is part of the eclib package.
//
// eclib is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// eclib is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License
// along with eclib; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
//
//////////////////////////////////////////////////////////////////////////
//

#include <iomanip>
#include <eclib/moddata.h>
#include <eclib/symb.h>
#include <eclib/oldforms.h>
#include <eclib/homspace.h>
#include <eclib/cperiods.h>     //from qcurves, for computing conductors
#include <eclib/newforms.h>
#include <eclib/periods.h>
#include <eclib/points.h>

#define AUTOLOOP
//#define BOOKORDER       // if defined, sorts newforms/curves into order
                         // in the Book (relevant up to 500 only)
#include <eclib/curvesort.h>
#define LMFDB_ORDER       // if defined, sorts newforms into LMFDB order before output

#define CURVE_IS_ONE_FIELD // outputs      [a1,a2,a3,a4,a6]
                           // else outputs a1 a2 a3 a4 a6

int main(void)
{
  int prec0 = 75;
  int maxprec = 300;
  int prec = prec0;
  int delta_prec = 30;
  set_precision(prec);
 int limit,n=1;
 string code;
#ifdef AUTOLOOP
 cerr<<"Enter first and last N: ";cin>>n>>limit;
 n--; cerr<<endl;
#ifdef CURVE_IS_ONE_FIELD
 cerr << "    N\tC\t#\t[a1,a2,a3,a4,a6]\tr\t|T|\tdeg(phi)" << endl;
#else
 cerr << "    N\tC\t#\ta1 a2  a3 a4          a6\tr\t|T|\tdeg(phi)" << endl;
#endif
 cerr << "----------------------------------------------------------------------" << endl;

 while (n<limit) { n++;
#else
 while (n>0) { cout<<"Enter level: "; cin>>n;
#endif
 if (n>0)
{
  newforms nf(n,0);
  int noldap=25;
  nf.createfromdata(1,noldap,0); // do not create from scratch if data absent
  int nnf = nf.n1ds;
  int inf = 1;
  if(nnf>0)
    {
      // cout<<"****************************"<<endl;
      // cout<<"N="<<n<<" before sorting: "<<endl;
      // cout<<"****************************"<<endl;
      // for (inf=0; inf<nnf; inf++)
      //   {
      //     code = codeletter(inf);
      //     cout<<code<<": ";
      //     vec_out(cout,nf.nflist[inf].aplist,20);  // outputs at most 20 eigs.
      //     cout<<endl;
      //   }
#ifdef LMFDB_ORDER
      nf.sort();
#endif
      // cout<<"****************************"<<endl;
      // cout<<"N="<<n<<" after  sorting: "<<endl;
      // cout<<"****************************"<<endl;
      // for (inf=0; inf<nnf; inf++)
      //   {
      //     code = codeletter(inf);
      //     cout<<code<<": ";
      //     vec_out(cout,nf.nflist[inf].aplist,20);  // outputs at most 20 eigs.
      //     cout<<endl;
      //   }
      // cout<<"****************************"<<endl;
    }
 for(int xi=0; xi<nnf; xi++)
   { int i=xi;
     code = codeletter(xi);
#ifdef BOOKORDER
     i=booknumber0(n,i);
#endif
     newform& nfi = nf.nflist[i];
     int degphi = nfi.degphi;
     bigfloat rperiod;
     int r = nfi.rank();
     Curve C;
     Curvedata CD;
     CurveRed CR;
     bigint nc; int nt;
     bigint a1,a2,a3,a4,a6;
     prec = prec0-delta_prec;
     while (C.isnull() && (prec<maxprec))
       {
	 prec += delta_prec;
	 set_precision(prec);
	 C = nf.getcurve(i, -1, rperiod);
         CD = Curvedata(C,1);  // The 1 causes minimalization
         CR = CurveRed(CD);
         nc = getconductor(CR);
         if(n!=nc) C = Curve();  // wrong conductor; reset to null curve
       }
     if (C.isnull())
       {
	 cout<<setw(6)<<n<<code<<": bad curve"<<endl;
	 continue;
       }

     CD.getai(a1,a2,a3,a4,a6);
     nt = ntorsion(CD);
     //     cout.form("%4d\t%s\t1\t",n,code);
     cout<<setw(6)<<n<<"\t"<<code<<"\t1\t";
#ifdef CURVE_IS_ONE_FIELD
     cout<<"["<<a1<<","<<a2<<","<<a3<<","<<a4<<","<<a6<<"]";
#else
     cout<<a1<<" "<<a2<<" "<<a3<<" "<<a4<<" "<<a6;
#endif
     cout << "\t" << r << "\t" << nt << "\t" << degphi << endl;
   }
}       // end of if(n)
}       // end of while()
}       // end of main()