-
Notifications
You must be signed in to change notification settings - Fork 1
/
cusp.cc
57 lines (52 loc) · 1.42 KB
/
cusp.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
// FILE CUSP.CC
#include "cusp.h"
void cusplist::display() const
{
int i=0;
for(const auto& c : cusps)
cout<<i++<<"\t"<< c <<endl;
}
//#define DEBUG_CUSPS
int cusplist::index(const RatQuad& c)
{
#ifdef DEBUG_CUSPS
cout<<"Testing cusp "<<c<<" against existing list"<<endl;
#endif
// add c to list if not there already, and return index
Quad n = N.gen();
int ic = 0;
for(const auto& ci : cusps)
{
#ifdef DEBUG_CUSPS
cout<<" comparing cusp "<<c<<" with cusp "<<ci<<endl;
int t = cuspeq_conj(ci, c, N, plusflag);
#else
int t = cuspeq(ci, c, N, plusflag);
#endif
if (Quad::class_number==1)
{
int t1 = cuspeq(ci, c, n, plusflag);
if (t1!=t)
{
cout<<"*********************************************************************************************************"<<endl;
cout<<"cuspeq("<<ci<<","<<c<<") should be "<<t1<<" but ideal version gives "<<t<<endl;
cout<<"*********************************************************************************************************"<<endl;
}
}
if (t)
{
#ifdef DEBUG_CUSPS
cout << "cusp "<<c<<" equivalent to cusp #"<<ic<<" ("<<cusps[ic]<<")"<<endl;
#endif
return ic;
}
ic++;
}
// not found:
cusps.push_back(c);
ic = cusps.size()-1;
#ifdef DEBUG_CUSPS
cout << "cusp "<<c<<" is new #"<<ic<<endl;
#endif
return ic;
}