forked from JohnCremona/eclib
/
h1first.cc
131 lines (125 loc) · 3.77 KB
/
h1first.cc
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
// FILE h1first.cc : h1 (full space)
//////////////////////////////////////////////////////////////////////////
//
// 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 <eclib/marith.h>
#include <eclib/moddata.h>
#include <eclib/symb.h>
#include <eclib/cusp.h>
#include <eclib/homspace.h>
#include <eclib/oldforms.h>
#include <eclib/cperiods.h> //from qcurves, for computing conductors
#include <eclib/newforms.h>
#include <eclib/periods.h>
#include <eclib/pcprocs.h>
#define AUTOLOOP
#define SHOWCURVES
#define LMFDB_ORDER // if defined, sorts newforms into LMFDB order before output
int main(void)
{
long prec0=25;
int verbose,output,curve_output,limit=210,n=130;
cout << "Program h1first. Using METHOD = " << METHOD << endl;
cerr << "Verbose output? "; cin>>verbose;
cerr << "Output updated newform data? "; cin>>output;
cerr << "Output updated curve file? (0/1) "; cin >> curve_output;
string curve_filename;
#ifdef AUTOLOOP
cerr<<"Enter first and last N: ";cin>>n>>limit; n--;
while (n<limit) { n++;
#else
while (n>0) { cout<<"\n\nEnter level: "; cin>>n;
#endif
if (n>0)
{
if (curve_output)
curve_filename=single_curve_filename(n);
else
curve_filename="no";
if(verbose) cout << "\n\n";
cout << ">>>Level " << n << "<<<" << endl;
newforms nf(n,verbose>1);
if(verbose)
{
cout << "Reading newform data from file..." << flush;
}
nf.createfromdata(1,0,0);
long inf, nnf = nf.n1ds;
if(verbose)
{
cout << "done: " << nnf << " newforms." << endl;
}
if(nnf==0)
{
cout << "No newforms.\n";
cout << "Finished level "<<n<<endl;
continue;
}
#ifdef LMFDB_ORDER
nf.sort();
#endif
if(verbose)
{
cout << "Finding +1 eigenvectors..." << flush;
}
nf.makebases(1);
if(verbose)
{
cout << "done.\nNow finding -1 eigenvectors..." << flush;
}
nf.set_sign(-1);
nf.makebases(1);
if(verbose)
{
cout << "done.\nNow filling in data for newforms..."<<flush;
}
nf.set_sign(0);
nf.merge();
if(verbose)
{
cout << "done.\nUpdated newforms: ";
nf.display();
}
if(output)
{
nf.output_to_file();
if(verbose)
cout << "saved updated newform data to file" << endl;
}
#ifdef SHOWCURVES
// Now we compute the curves
if(verbose) cout<<"Computing "<<nnf<<" curves...\n";
vector<int> forms;
for(inf=0; inf<nnf; inf++) forms.push_back(inf);
vector<int> failures = nf.showcurves(forms,0,curve_filename);
if(failures.size()>0)
{
cout<<"No curve found for "<<failures.size()<<" forms: "<<failures<<endl;
}
else
{
if(verbose) cout<<"All curves found OK"<<endl;
}
#endif
} // end of if(n)
} // end of while()
if(verbose) cout<<"Finished"<<endl;
} // end of main()