Skip to content

Commit

Permalink
fix saturation bug; bump version to 20150323, library to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCremona committed Mar 23, 2015
1 parent 1006c91 commit 406c431
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.65])
AC_INIT([eclib], [20150228], [[email protected]])
AC_INIT([eclib], [20150323], [[email protected]])
AM_INIT_AUTOMAKE([-Wall])
AC_MSG_NOTICE([Configuring eclib...])
AC_CONFIG_SRCDIR([libsrc])
Expand All @@ -24,7 +24,7 @@ LT_INIT
# 3. If interfaces were removed (breaks backward compatibility): increment
# current, and set both revision and age to zero.
LT_CURRENT=1
LT_REVISION=0
LT_REVISION=1
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
Expand Down
37 changes: 21 additions & 16 deletions libsrc/egr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ bigint egr_index(const vector<Point>& Plist, int real_too)
imagematrix.push_back(im);
vector<int> CG=CGS.ComponentGroup(*pi);
for(unsigned int ni=0; ni<CG.size(); ni++, n++)
moduli.push_back(CG[ni]);
moduli.push_back(CG[ni]);
}
mat m(Plist.size(),n);
unsigned int j=0, j1, j2, i;
Expand Down Expand Up @@ -806,7 +806,7 @@ bigint comp_map_image(const vector<int> moduli, const mat& image)
#endif
if(modulus==1) continue;
#ifdef DEBUG_INDEX
cout<<"Column = "<<m.col(j)<<endl;
cout<<"Column "<<j<<" = "<<m.col(j)<<endl;
#endif
for(i=1; (i<=npts); i++) m(i,j)=m(i,j)%modulus;
long g=0,gm;
Expand All @@ -830,7 +830,7 @@ bigint comp_map_image(const vector<int> moduli, const mat& image)
#endif
if(modulus==1) continue;
#ifdef DEBUG_INDEX
cout<<"Column = "<<m.col(j)<<endl;
cout<<"Column "<<j<<" = "<<m.col(j)<<endl;
#endif
long colmin=modulus, imin=0, r, q;
while(abs(colmin)>1)
Expand All @@ -843,7 +843,7 @@ bigint comp_map_image(const vector<int> moduli, const mat& image)
if(abs(m(i,j))<abs(colmin)) colmin=m(i,j);
for(i=1; i<=npts; i++) if(m(i,j)==colmin) {imin=i; break;}
#ifdef DEBUG_INDEX
cout<<"colmin = "<<colmin<<" at imin="<<imin<<endl;
cout<<"colmin = "<<colmin<<" at row imin="<<imin<<endl;
#endif
for(i=1; i<=npts; i++)
if(ndivides(colmin,m(i,j)))
Expand All @@ -856,31 +856,36 @@ bigint comp_map_image(const vector<int> moduli, const mat& image)
for(jj=1; jj<=np; jj++) m(i,jj)-=q*m(imin,jj);
}
#ifdef DEBUG_INDEX
cout<<"Column = "<<m.col(j)<<endl;
cout<<"Column "<<j<<" = "<<m.col(j)<<endl;
#endif
}
}
// now |colmin|=1 and we can clear
#ifdef DEBUG_INDEX
cout<<"colmin = "<<colmin<<", clearing..."<<endl;
cout<<"Column = "<<m.col(j)<<endl;
cout<<"Column "<<j<<" = "<<m.col(j)<<endl;
#endif
for(i=1; i<=npts; i++) if(m(i,j)==colmin) {imin=i; break;}
for(i=1; i<=npts; i++)
if(m(i,j)==colmin)
{
imin=i; break;
}
for(i=1; i<=npts; i++)
if(i!=imin)
for(jj=1; jj<=np; jj++)
{
if(colmin==1)
m(i,jj)-=m(i,j)*m(imin,jj);
else
m(i,jj)+=m(i,j)*m(imin,jj);
}
{
long piv = m(i,j)*colmin;
for(jj=1; jj<=np; jj++)
{
m(i,jj) = (m(i,jj)-piv*m(imin,jj)) % moduli[jj-1];
}
}
// now update matrix and ans:
#ifdef DEBUG_INDEX
cout<<"Now matrix = "<<m<<endl;
cout<<"Column = "<<m.col(j)<<endl;
cout<<"multiplying ans and row "<<imin<<" by "<<modulus<<endl;
#endif
ans*=modulus;
for(jj=1; jj<=np; jj++)
for(jj=1; jj<=np; jj++)
m(imin,jj)=(modulus*m(imin,jj))%moduli[jj-1];
#ifdef DEBUG_INDEX
cout<<"Now matrix = "<<m<<endl;
Expand Down
9 changes: 7 additions & 2 deletions tests/tsat3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,14 @@ int main()
}
cout<<"Input torsion points: "<<tpoints<<endl;

bigint index;
bigint index = BIGINT(1);
vector<long> unsatprimes;
int success = saturate_points(C, points, index, unsatprimes, SAT_BND, use_egr, (verbose));
int success = 1;

if (npts)
{
success = saturate_points(C, points, index, unsatprimes, SAT_BND, use_egr, (verbose));
}

if(success)
{
Expand Down

0 comments on commit 406c431

Please sign in to comment.