This commit is contained in:
Jan Engelhardt 2024-09-10 11:31:47 +02:00
parent 3ddbe9d277
commit b5fee18cca
13 changed files with 1335 additions and 260 deletions

View File

@ -1,74 +0,0 @@
From: Jan Engelhardt <jengelh@inai.de>
Date: 2020-09-19 11:39:47.110726857 +0200
To fix the CDDPREFIX yes-or-no conundrum, cddlib 0.94k has introduced
new unique locations for use inside <>. Adjust gfan.
---
src/app_librarytest.cpp | 9 ++-------
src/gfanlib_zcone.cpp | 9 ++-------
src/lp_cdd.cpp | 12 +++---------
3 files changed, 7 insertions(+), 23 deletions(-)
Index: gfan0.6.2/src/app_librarytest.cpp
===================================================================
--- gfan0.6.2.orig/src/app_librarytest.cpp
+++ gfan0.6.2/src/app_librarytest.cpp
@@ -8,13 +8,8 @@
#include "gfanapplication.h"
#include "gfanlib.h"
#include "printer.h"
-#ifdef NOCDDPREFIX
-#include "setoper.h"
-#include "cdd.h"
-#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
-#endif
+#include <cddlib/setoper.h>
+#include <cddlib/cdd.h>
#include <iostream>
#include <fstream>
using namespace gfan;
Index: gfan0.6.2/src/gfanlib_zcone.cpp
===================================================================
--- gfan0.6.2.orig/src/gfanlib_zcone.cpp
+++ gfan0.6.2/src/gfanlib_zcone.cpp
@@ -12,13 +12,8 @@
#include <sstream>
//extern "C"{
-#ifdef NOCDDPREFIX
-#include "setoper.h"
-#include "cdd.h"
-#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
-#endif
+#include <cddlib/setoper.h>
+#include <cddlib/cdd.h>
//}
namespace gfan{
Index: gfan0.6.2/src/lp_cdd.cpp
===================================================================
--- gfan0.6.2.orig/src/lp_cdd.cpp
+++ gfan0.6.2/src/lp_cdd.cpp
@@ -1,14 +1,8 @@
#include "lp_cdd.h"
//extern "C"{
-#ifdef NOCDDPREFIX
-#include "setoper.h"
-#include "cdd.h"
-#include "cdd_f.h"
-#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
-#include "cdd/cdd_f.h"
-#endif
+#include <cddlib/setoper.h>
+#include <cddlib/cdd.h>
+#include <cddlib/cdd_f.h>
//}
#include "termorder.h"
#include "printer.h"

File diff suppressed because one or more lines are too long

12
gfan-c++20.patch Normal file
View File

@ -0,0 +1,12 @@
--- gfan0.7/src/gfanlib_circuittableint.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_circuittableint.h 2024-08-15 16:14:29.983298300 -0600
@@ -591,7 +591,8 @@ public:
ret=min;
{
- auto ret2=CircuitTableIntPOD((s.v*denominatorDivisor.multiplicativeInverse)*boundA.v);
+ CircuitTableIntPOD ret2{};
+ ret2=(s.v*denominatorDivisor.multiplicativeInverse)*boundA.v;
ret2=MIN(ret2.v,-ret2.v);
return ret2;
if(ret.v!=ret2.v)

14
gfan-gcd.patch Normal file
View File

@ -0,0 +1,14 @@
--- gfan0.7/src/gfanlib_q.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_q.h 2024-08-16 10:13:16.625990374 -0600
@@ -179,6 +179,11 @@ public:
assert(0 && "gcd for Rational not defined");
return a;
}
+ static Rational gcd(Rational const &a, Rational const &b)
+ {
+ assert(0 && "gcd for Rational not defined");
+ return a;
+ }
/**
* Assigns the value to q. q must have been initialized as a gmp variable.
*/

19
gfan-multiplicities.patch Normal file
View File

@ -0,0 +1,19 @@
---
src/gfanlib_zfan.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: gfan0.7/src/gfanlib_zfan.cpp
===================================================================
--- gfan0.7.orig/src/gfanlib_zfan.cpp
+++ gfan0.7/src/gfanlib_zfan.cpp
@@ -37,7 +37,9 @@ namespace gfan
{
IntVector indices=getConeIndices(dimension,index,orbit,maximal);
ZCone ret=this->complex->makeZCone(indices);
- if(maximal)ret.setMultiplicity(((orbit)?multiplicitiesOrbits:multiplicities)[dimension][index]);
+ const std::vector<std::vector<Integer> >&mult = orbit ? multiplicitiesOrbits : multiplicities;
+ if(maximal && mult.size() > dimension && mult[dimension].size() > index)
+ ret.setMultiplicity(mult[dimension][index]);
return ret;
}
IntVector ZFan::getConeIndices(int dimension, int index, bool orbit, bool maximal)const

View File

@ -13,11 +13,33 @@ respective classes into anonymous namespaces to comply with ODR.
src/tropicaltraverse.cpp | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/src/gfanlib_traversal.cpp b/src/gfanlib_traversal.cpp
index dce38c1..3e9a746 100644
--- a/src/gfanlib_traversal.cpp
+++ b/src/gfanlib_traversal.cpp
@@ -62,6 +62,8 @@ bool FanBuilder::process(FanTraverser &traverser)
Index: gfan0.7/src/gfanlib_traversal.cpp
===================================================================
--- gfan0.7.orig/src/gfanlib_traversal.cpp
+++ gfan0.7/src/gfanlib_traversal.cpp
@@ -45,6 +45,8 @@ bool FanBuilder::process(FanTraverser &t
+namespace
+{
/**
* Classes
@@ -159,6 +161,8 @@ public:
}
};
+}
+
/**
Rewrite these comments.
Index: gfan0.7/src/symmetrictraversal.cpp
===================================================================
--- gfan0.7.orig/src/symmetrictraversal.cpp
+++ gfan0.7/src/symmetrictraversal.cpp
@@ -103,6 +103,8 @@ bool SymmetricTargetVertexSetBuilder::pr
in the computation is made these edges will be deleted.
*/
@ -26,41 +48,19 @@ index dce38c1..3e9a746 100644
class Boundary
{
@@ -185,6 +187,8 @@ struct pathStepFacet
list<ZVector> ridgesRayUniqueVector;//stores the ray of the link that we came from
@@ -231,6 +233,8 @@ public:
}
};
+}
+
/**
We need to simulate two mutually recursive functions. An actual
implementation of these two functions would probably not work since
diff --git a/src/symmetrictraversal.cpp b/src/symmetrictraversal.cpp
index 8cf6f40..4fe66e0 100644
--- a/src/symmetrictraversal.cpp
+++ b/src/symmetrictraversal.cpp
@@ -103,6 +103,8 @@ bool SymmetricTargetVertexSetBuilder::process(ConeTraverser &traverser)
in the computation is made these edges will be deleted.
*/
Rewrite these comments.
+namespace
+{
class Boundary
{
@@ -258,6 +260,8 @@ struct pathStepFacet
IntegerVectorList ridgesRayUniqueVector;//stores the ray of the link that we came from
};
+}
+
/**
We need to simulate two mutually recursive functions. An actual
implementation of these two functions would probably not work since
diff --git a/src/tropicaltraverse.cpp b/src/tropicaltraverse.cpp
index 05e9747..c01a69f 100644
--- a/src/tropicaltraverse.cpp
+++ b/src/tropicaltraverse.cpp
Index: gfan0.7/src/tropicaltraverse.cpp
===================================================================
--- gfan0.7.orig/src/tropicaltraverse.cpp
+++ gfan0.7/src/tropicaltraverse.cpp
@@ -104,6 +104,9 @@ public:
}
};
@ -71,15 +71,12 @@ index 05e9747..c01a69f 100644
/**
Rewrite these comments.
@@ -130,6 +133,8 @@ struct pathStepFacet
IntegerVectorList ridges;
};
@@ -135,6 +138,8 @@ struct pathStepFacet
using namespace tropicalTraverseNamespace;
+}
+
/**
We need to simulate two mutually recursive functions. An actual
implementation of these two functions would propably not work since
--
2.32.0

398
gfan-soplex.patch Normal file
View File

@ -0,0 +1,398 @@
--- gfan0.7/src/lp_soplexcdd.cpp.orig 2024-08-12 13:34:07.043619886 -0600
+++ gfan0.7/src/lp_soplexcdd.cpp 2024-08-12 13:42:14.382953300 -0600
@@ -1,37 +1,11 @@
#include "lp_soplexcdd.h"
-#include "printer.h"
-
-#include "spxdefines.h"
-#include "spxsolver.h"
-
-#include "timer.h"
-#include "spxpricer.h"
-//#include "spxdefaultpr.h"
-#include "spxparmultpr.h"
-#include "spxdevexpr.h"
-#include "spxhybridpr.h"
-#include "spxsteeppr.h"
-#include "spxweightpr.h"
-#include "spxratiotester.h"
-#include "spxharrisrt.h"
-#include "spxdefaultrt.h"
-#include "spxfastrt.h"
-#include "spxsimplifier.h"
-//#include "spxaggregatesm.h"
-//#include "spxredundantsm.h"
-//#include "spxrem1sm.h"
-//#include "spxgeneralsm.h"
-#include "spxscaler.h"
-#include "spxequilisc.h"
-#include "spxsumst.h"
-#include "spxweightst.h"
-#include "spxvectorst.h"
-#include "slufactor.h"
-#include "soplex.h"
+#include <soplex/spxdefines.h>
+#include <soplex.h>
#include "continuedfractions.h"
#include "matrix.h"
#include "linalg.h"
+#include "printer.h"
#include "log.h"
using namespace soplex;
@@ -42,81 +16,45 @@ using namespace soplex;
class MySoPlex : public SoPlex
{
private:
- SLUFactor m_slu;
+ SLUFactor<Real> m_slu;
public:
/// default constructor
- MySoPlex(SPxSolver::Type p_type = SPxSolver::LEAVE, SPxSolver::Representation p_rep = SPxSolver::COLUMN)
- : SoPlex(p_type, p_rep)
+ MySoPlex() : SoPlexBase<Real>()
{
+ NameSet rownames;
+ NameSet colnames;
+ SPxOut::Verbosity verbose = SPxOut::Verbosity::ERROR;
+ SLUFactor<Real>::UpdateType update = SLUFactor<Real>::FOREST_TOMLIN;
+ Real timelimit = 1.0;
+ spxout.setVerbosity(verbose);
+ //options -p4 -t2 -g1 -s0 -c0
+ setUtype(update);
- bool print_solution = false;
- bool print_quality = false;
- NameSet rownames;
- NameSet colnames;
- SPxStarter* starter = 0;
- SPxSolver::Type type = SPxSolver::LEAVE;
- SPxSolver::Representation representation = SPxSolver::COLUMN;
- int precision;
- Real delta = DEFAULT_BND_VIOL;
- Real epsilon = DEFAULT_EPS_ZERO;
- int verbose = 0;
- SLUFactor::UpdateType update = SLUFactor::FOREST_TOMLIN;
- Real timelimit = 1.0;-1.0;
- SPxPricer* pricer = 0;
- SPxRatioTester* ratiotester = 0;
- SPxScaler* scaler = 0;
- SPxSimplifier* simplifier = 0;
-
- precision = int(-log10(delta)) + 1;
-
- Param::setEpsilon(epsilon);
- Param::setVerbose(verbose);
-
-
-
- //options -p4 -t2 -g1 -s0 -c0
- setUtype(update);
- setTerminationTime(timelimit);
- setDelta(delta);
-
- assert(isConsistent());
-
- pricer = new SPxSteepPR;
- setPricer(pricer);
- assert(isConsistent());
+ setRealParam(TIMELIMIT, timelimit);
+ assert(isConsistent());
- ratiotester = new SPxFastRT;
- setTester(ratiotester);
- assert(isConsistent());
+ setIntParam(PRICER, PRICER_STEEP);
+ assert(isConsistent());
- /* scaler = new SPxEquili(representation == SoPlex::COLUMN, true);
- setScaler(scaler);
- assert(isConsistent());
- */
- setSimplifier(simplifier);
- assert(isConsistent());
+ setIntParam(RATIOTESTER, RATIOTESTER_FAST);
+ assert(isConsistent());
- setStarter(starter);
- assert(isConsistent());
- }
+ setIntParam(SIMPLIFIER, SIMPLIFIER_OFF);
+ assert(isConsistent());
- virtual bool terminate()
- {
- /* if (iteration() % 100 == 0)
- std::cout << iteration() << ":\t" << value() << std::endl;
- */
- return SoPlex::terminate();
+ setIntParam(STARTER, STARTER_OFF);
+ assert(isConsistent());
}
- void setUtype(SLUFactor::UpdateType tp)
+ void setUtype(SLUFactor<Real>::UpdateType tp)
{
m_slu.setUtype(tp);
}
- void build(const IntegerVectorList &g, IntegerVectorList::const_iterator i)
+ void build(const IntegerVectorList &g, IntegerVectorList::const_iterator i)
{
int width=g.size()-1;
int height=i->v.size();
@@ -141,22 +79,23 @@ public:
cols.add(obj,lower,c1,upper);
}
}
-
+
LPRowSet rows(height,width*height);
DSVector r1(width);
-
+
//Change Rows
for(int t=0;t<height;t++)
rows.add(i->v[t],r1,i->v[t]);
-
- addRows(rows);
- addCols(cols);
-
- changeSense(SPxLP::MINIMIZE);
-
+
+ addRowsReal(rows);
+ addColsReal(cols);
+
+ setIntParam(OBJSENSE, OBJSENSE_MINIMIZE);
+
assert(isConsistent());
}
- void buildType2(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations)
+
+ void buildType2(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations)
{
int width=n;
int nInequalities=inequalities.size();
@@ -192,27 +131,29 @@ public:
LPRowSet rows(height,width*height);
DSVector r1(width);
-
+
//Change Rows
for(int t=0;t<nInequalities;t++)
rows.add(0,r1,infinity);
for(int t=nInequalities;t<height;t++)
rows.add(0,r1,0);
-
- addRows(rows);
- addCols(cols);
-
- changeSense(SPxLP::MINIMIZE);
-
+
+ addRowsReal(rows);
+ addColsReal(cols);
+
+ setIntParam(OBJSENSE, OBJSENSE_MINIMIZE);
+
assert(isConsistent());
}
};
static int toint(float r)
{
- return *((int*)&r);
+ int *theInt = reinterpret_cast<int *>(&r);
+ return *theInt;
}
+#if 0
static void printLP(SPxLP &w)
{
std::cout << "LP has "
@@ -272,10 +213,9 @@ static void printLP(SPxLP &w)
std::cout<<toint(R.lhs())<<" "<<toint(R.rhs())<<" "<<R.type()<<std::endl;
}
}
+#endif
-
-MySoPlex work(SPxSolver::LEAVE, SPxSolver::COLUMN);
-
+static MySoPlex work;
static bool isFeasibleSolution(IntegerVector const &solution, int denominator, IntegerVectorList const &g, IntegerVectorList::const_iterator i)
{
@@ -308,7 +248,7 @@ static bool isInfeasibilityCertificate(I
/* for(IntegerVectorList::const_iterator j=g.begin();j!=g.end();j++)
{*/
/* double prod=0;
- for(int i=0;i<work.nRows();i++)
+ for(int i=0;i<work.numRows();i++)
{prod+=(*j)[i]*certificate[i];
// fprintf(stderr,"%f \n",prod);
}
@@ -357,17 +297,13 @@ static bool isInfeasibilityCertificateTy
bool LpSolverSoPlexCddGmp::isFacet(const IntegerVectorList &g, IntegerVectorList::const_iterator I)
{
- SPxSolver::Type type = SPxSolver::LEAVE;
- SPxSolver::Representation representation = SPxSolver::COLUMN;
-
int lp_status=0;
- work.clear();
+ work.clearLPReal();
+ work.clearBasis();
work.build(g,I);
- retry:
-
// std::cerr<< work;
work.solve();
@@ -377,19 +313,19 @@ bool LpSolverSoPlexCddGmp::isFacet(const
{
case SPxSolver::OPTIMAL:
{
- DVector objx(work.nCols());
+ DVector objx(work.numCols());
- if( work.getPrimal(objx) != SPxSolver::ERROR )
+ if( work.getPrimal(objx) )
{
- vector<double> solution(work.nCols());
- for(int i=0;i<work.nCols();i++)
+ vector<double> solution(work.numCols());
+ for(int i=0;i<work.numCols();i++)
solution[i]=objx[i];
vector<int> solutionNum;
int denominator;
doubleVectorToFractions(solution,solutionNum,denominator);
IntegerVector s(solution.size());
- for(int i=0;i<s.size();i++)s[i]=solutionNum[i];
+ for(size_t i=0;i<s.size();i++)s[i]=solutionNum[i];
if(isFeasibleSolution(s,denominator,g,I))
{
@@ -407,19 +343,19 @@ bool LpSolverSoPlexCddGmp::isFacet(const
break;
case SPxSolver::INFEASIBLE:
{
- DVector farkasx(work.nRows());
+ DVector farkasx(work.numRows());
- if( work.getDualfarkas(farkasx) != SPxSolver::ERROR )
+ if( work.getDualFarkas(farkasx) )
{
- vector<double> certificate(work.nRows());
- for(int i=0;i<work.nRows();i++)
+ vector<double> certificate(work.numRows());
+ for(int i=0;i<work.numRows();i++)
certificate[i]=farkasx[i];
vector<int> certificateNum;
int denominator;
doubleVectorToFractions(certificate,certificateNum,denominator);
IntegerVector c(certificate.size());
- for(int i=0;i<c.size();i++)c[i]=certificateNum[i];
+ for(size_t i=0;i<c.size();i++)c[i]=certificateNum[i];
if(isInfeasibilityCertificate(c,g,I))
{
@@ -462,17 +398,13 @@ bool LpSolverSoPlexCddGmp::isFacet(const
bool LpSolverSoPlexCddGmp::hasHomogeneousSolution(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations)
{
- SPxSolver::Type type = SPxSolver::LEAVE;
- SPxSolver::Representation representation = SPxSolver::COLUMN;
-
int lp_status=0;
- work.clear();
+ work.clearLPReal();
+ work.clearBasis();
work.buildType2(n,inequalities,equations);
- retry:
-
// std::cerr<< work;
// assert(0);
@@ -484,19 +416,19 @@ bool LpSolverSoPlexCddGmp::hasHomogeneou
{
case SPxSolver::OPTIMAL:
{
- DVector objx(work.nCols());
+ DVector objx(work.numCols());
- if( work.getPrimal(objx) != SPxSolver::ERROR )
+ if( work.getPrimal(objx) )
{
- vector<double> solution(work.nCols());
- for(int i=0;i<work.nCols();i++)
+ vector<double> solution(work.numCols());
+ for(int i=0;i<work.numCols();i++)
solution[i]=objx[i];
vector<int> solutionNum;
int denominator;
doubleVectorToFractions(solution,solutionNum,denominator);
IntegerVector s(solution.size());
- for(int i=0;i<s.size();i++)s[i]=solutionNum[i];
+ for(size_t i=0;i<s.size();i++)s[i]=solutionNum[i];
// AsciiPrinter(Stderr).printVector(s);
if(isFeasibleSolutionType2(s,inequalities,equations))
@@ -512,7 +444,7 @@ if(0) {
{
double S=0;
assert(i->size()==solution.size());
- for(int j=0;j<i->size();j++)S+=solution[j]*(*i)[j];
+ for(size_t j=0;j<i->size();j++)S+=solution[j]*(*i)[j];
if(S>-0.000001 && S<0.000001)A.push_back(*i);
}
FieldMatrix temp=integerMatrixToFieldMatrix(rowsToIntegerMatrix(A,solution.size()),Q);
@@ -538,7 +470,7 @@ if(0) {
*/
log2 fprintf(Stderr,"Solution failed (Type2).\n");
- /* for(int i=0;i<work.nCols();i++)
+ /* for(int i=0;i<work.numCols();i++)
{
std::cerr<<solution[i]<<',';
}
@@ -558,19 +490,19 @@ if(0) {
break;
case SPxSolver::INFEASIBLE:
{
- DVector farkasx(work.nRows());
+ DVector farkasx(work.numRows());
- if( work.getDualfarkas(farkasx) != SPxSolver::ERROR )
+ if( work.getDualFarkas(farkasx) )
{
- vector<double> certificate(work.nRows());
- for(int i=0;i<work.nRows();i++)
+ vector<double> certificate(work.numRows());
+ for(int i=0;i<work.numRows();i++)
certificate[i]=farkasx[i];
vector<int> certificateNum;
int denominator;
doubleVectorToFractions(certificate,certificateNum,denominator);
IntegerVector c(certificate.size());
- for(int i=0;i<c.size();i++)c[i]=certificateNum[i];
+ for(size_t i=0;i<c.size();i++)c[i]=certificateNum[i];
if(isInfeasibilityCertificateType2(c,n,inequalities,equations))
{

813
gfan-warning.patch Normal file
View File

@ -0,0 +1,813 @@
--- gfan0.7/src/app_librarytest.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/app_librarytest.cpp 2024-08-12 11:05:45.720320231 -0600
@@ -12,8 +12,8 @@
#include "setoper.h"
#include "cdd.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
#endif
#include <iostream>
#include <fstream>
--- gfan0.7/src/application.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/application.cpp 2024-08-12 11:05:45.720320231 -0600
@@ -3,6 +3,8 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
+#include <limits.h>
+#include <unistd.h>
#include <string>
#include <list>
#include <vector>
@@ -566,11 +568,11 @@ void Application::makeSymbolicLinks(cons
if(all || p->includeInDefaultInstallation())
if(strlen(p->name())>0)
{
- char c[1024];
- sprintf(c,"ln -s %s%s %s%s%s\n",path,name,path,name,p->name());
- fprintf(stderr,"%s",c);
- int err=system(c);
- assert(err==0);
+ char c[PATH_MAX], d[PATH_MAX];
+ snprintf(c,PATH_MAX,"%s%s",path,name);
+ snprintf(d,PATH_MAX,"%s%s%s",path,name,p->name());
+ fprintf(stderr,"ln -s %s %s\n",c,d);
+ symlink(c,d);
}
p=p->next;
}
--- gfan0.7/src/app_test.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/app_test.cpp 2024-08-13 10:46:14.680617406 -0600
@@ -1,5 +1,8 @@
#include <iostream>
#include <stdlib.h>
+#include <dirent.h>
+#include <errno.h>
+#include <unistd.h>
#include "parser.h"
#include "printer.h"
#include "polynomial.h"
@@ -813,7 +816,7 @@ int testGfanLib()
int largest=10+2;
vector<int> halfOpenConesStatistics(largest+1);
vector<int> nonEmptyIntersectionsStatistics(largest+1);
- for(int k=2/*largest/*2*/;k<=largest;k++)
+ for(int k=2/*largest/2*/;k<=largest;k++)
{
vector<HalfOpenCone<CircuitTableInt32> > f;
vector<gfan::Matrix<CircuitTableInt32> > configurations=convertMatrixVectorT(MixedVolumeExamples::cyclic(k));
@@ -1333,11 +1336,7 @@ if(0) {
{
outputName=outputName+"New";
}
- int err=0;
- {
- string t="rm -f "+outputName;
- err|=system(t.c_str());
- }
+ int err=(unlink(outputName.c_str()) == 0 || errno == ENOENT) ? 0 : 1;
string command3="cat <"+input+"|"+string(command2)+">"+outputName;
cerr<<"Running command:\""<<command3<<"\""<<endl;
err|=system(command3.c_str());
@@ -1351,24 +1350,17 @@ if(0) {
list<string> subFolderNames()
{
-#define tempName "GfAnTeMpTeStS"
- char command[256];
- int err=system("rm " tempName);
- err=0;//Having err!=0 above is probably not at mistake. Rather the file did not exist.
- sprintf(command,"ls %s>" tempName ,testSuiteFolderOption.getValue());
- err|=system(command);
- assert(err==0);
-
list<string> ret;
- FILE *f=fopen(tempName,"r");
- assert(f);
- char name[256];
- while(fgets(name,255,f))
+ DIR *dir = opendir(testSuiteFolderOption.getValue());
+ struct dirent *dirent;
+
+ assert(dir);
+ for (struct dirent *ent = readdir(dir); ent; ent = readdir(dir))
{
- for(int i=0;i<255 && name[i];i++)if(name[i]=='\n'){name[i]=0;}
- if(name[0]>='0' && name[0]<='9')ret.push_back(string(testSuiteFolderOption.getValue())+"/"+string(name));
+ if (ent->d_name[0]>='0' && ent->d_name[0]<='9')
+ ret.push_back(string(testSuiteFolderOption.getValue())+"/"+string(ent->d_name));
}
- fclose(f);
+ closedir(dir);
return ret;
}
@@ -1379,7 +1371,7 @@ if(0) {
// gfan::Matrix<CircuitTableInteger>::readMatrix(cin,4);
}
- if(developerTestOption.getValue()!="testsuite")
+ if(strcmp(developerTestOption.getValue(),"testsuite") != 0)
{
// lpRationalFunctionTest();
// testRationalFunctionField();
--- gfan0.7/src/bergman.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/bergman.cpp 2024-08-12 11:05:45.721320218 -0600
@@ -327,7 +327,7 @@ log0 AsciiPrinter(Stderr).printPolynomia
if(doesPermutationFixCone(*j))numFixed++;
// fprintf(Stderr,"groupSize = %i, numFixed = %i\n",groupSize,numFixed);
- return groupSize/numFixed;
+ return (numFixed>0) ? groupSize/numFixed : 0;
}
void markFacet(IntegerVector const &relIntRidgeVector)
--- gfan0.7/src/breadthfirstsearch.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/breadthfirstsearch.cpp 2024-08-12 11:05:45.722320204 -0600
@@ -260,7 +260,7 @@ public:
}
log2 fprintf(Stderr,"numFixed = %i\n",numFixed);
- return groupSize/numFixed;
+ return (numFixed>0) ? groupSize/numFixed : 0;
}
};
--- gfan0.7/src/bsptree.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/bsptree.cpp 2024-08-12 11:05:45.722320204 -0600
@@ -131,7 +131,8 @@ public:
p=&(i->first);
}
}
- normal=*p;
+ if (p)
+ normal=*p;
}
return normal;
}
--- gfan0.7/src/enumeration.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/enumeration.h 2024-08-12 11:05:45.722320204 -0600
@@ -36,7 +36,7 @@ class EnumerationFilePrinter: public Enu
FILE *file;
public:
EnumerationFilePrinter();
- ~EnumerationFilePrinter();
+ virtual ~EnumerationFilePrinter();
void open(std::string filename);
void open(FILE *file);
@@ -61,6 +61,7 @@ class EnumerationAlgorithm
bool targetBasis(const PolynomialSet &groebnerBasis){bool ret=true;if(target)ret=target->basis(groebnerBasis);printProgress();return ret;}
public:
EnumerationAlgorithm(){target=0;progressCounter=0;}
+ virtual ~EnumerationAlgorithm(){}
void setEnumerationTarget(EnumerationTarget *target){this->target=target;}
virtual void enumerate(const PolynomialSet &groebnerBasis){}
};
--- gfan0.7/src/field.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/field.h 2024-08-13 10:48:41.438830878 -0600
@@ -207,7 +207,7 @@ class FieldElementImplementation
virtual int getIntegerRepresentation()const
{
fprintf(stderr,"*this is not in Z/pZ.\n");
- assert(0);
+ abort();
}
virtual bool isInteger()const
{
@@ -222,7 +222,7 @@ class FieldElementImplementation
Field& operator=(const Field& a)
{
- assert(0);
+ abort();
}//assignment
};
@@ -270,7 +270,7 @@ class FieldImplementation
virtual FieldElement zHomomorphism(int n)=0;
virtual FieldElement random()
{
- assert(0);
+ abort();
}
virtual int getCharacteristic()const=0;
virtual const char *name()=0;
--- gfan0.7/src/field_rationalfunctions2.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/field_rationalfunctions2.cpp 2024-08-13 10:49:15.909411259 -0600
@@ -509,7 +509,7 @@ class FieldElementRationalFunction2 : pu
static string LaTeXTranslator(const string &s)
{
- assert(0);//not supported yet
+ abort();//not supported yet
/* int startIndex=0;
string sign;
if(s[0]=='-')
--- gfan0.7/src/field_rationals.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/field_rationals.cpp 2024-08-12 13:56:15.163561256 -0600
@@ -397,7 +397,7 @@ const char *FieldRationalsImplementation
/*FieldRationals::FieldRationals():
Field(new FieldRationalsImplementation())
-{
+{*/
/* fprintf(Stderr,"Adding field rationals\n");
next=list;
list=this;
--- gfan0.7/src/gfanlib_matrix.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_matrix.h 2024-08-12 13:31:35.566692074 -0600
@@ -45,7 +45,7 @@ template <class T>
class HasMemberType_##Type
{
private:
-/* using Yes=char[2];
+ using Yes=char[2];
using No=char[1];
struct Fallback {struct Type{};};
struct Derived:T,Fallback{};
--- gfan0.7/src/gfanlib_memoryresource.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_memoryresource.h 2024-08-12 13:31:08.231066021 -0600
@@ -34,7 +34,7 @@ void test() {
// t.a=0;
for(int i=0;i<100000;i++)
{
- std::experimental::pmr::vector<MyInt> A(100000,t/* ,&stackResource/);
+ std::experimental::pmr::vector<MyInt> A(100000,t,&stackResource);
//A.resize(100000,MyInt{});
}
}
--- gfan0.7/src/gfanlib_symmetry.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_symmetry.cpp 2024-08-12 11:05:45.722320204 -0600
@@ -423,7 +423,7 @@ int SymmetryGroup::orbitSize(ZVector con
if(doesFix)numFixed++;
}
}
- return groupSize/numFixed;
+ return (numFixed>0) ? groupSize/numFixed : 0;
}
--- gfan0.7/src/gfanlib_tableau.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_tableau.h 2024-08-13 10:59:21.016045143 -0600
@@ -845,7 +845,7 @@ template <class mvtyp> class Tableau{
return true;//break; //If this is reached we are ok
}
}
- assert(0);
+ abort();
}
void checkInLexTriangulation()
{
@@ -3059,7 +3059,7 @@ static bool isSubsetOf(vector<int> const
// polymakeFile.writeCardinalProperty("DIM",getMaxDim());
polymakeFile.writeCardinalProperty("LINEALITY_DIM",linealitySpace.getHeight());
// if(flags&&FPF_boundedInfo)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true);//??????
- if(flags&&FPF_rays)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true);
+ if(flags&FPF_rays)polymakeFile.writeMatrixProperty("RAYS",toZMatrix(vertices),true);
polymakeFile.writeCardinalProperty("N_RAYS",vertices.getHeight());
polymakeFile.writeMatrixProperty("LINEALITY_SPACE",toZMatrix(linealitySpace),ambientDimension);
--- gfan0.7/src/gfanlib_zcone.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_zcone.cpp 2024-08-12 11:05:45.723320190 -0600
@@ -16,8 +16,8 @@
#include "setoper.h"
#include "cdd.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
#endif
//}
@@ -52,8 +52,8 @@ namespace gfan{
"dd_free_global_constants()\n"
"in your deinitialisation code (only available for cddlib version>=094d).\n"
"This requires the header includes:\n"
- "#include \"cdd/setoper.h\"\n"
- "#include \"cdd/cdd.h\"\n"
+ "#include \"cddlib/setoper.h\"\n"
+ "#include \"cddlib/cdd.h\"\n"
"\n"
"Alternatively, you may call gfan:initializeCddlibIfRequired() and deinitializeCddlibIfRequired()\n"
"if gfanlib is the only code using cddlib. If at some point cddlib is no longer required by gfanlib\n"
--- gfan0.7/src/gfanlib_z.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/gfanlib_z.h 2024-08-12 13:53:41.429631248 -0600
@@ -218,17 +218,17 @@ namespace gfan{
{
return !(((long int)(value->_mp_d))&1);
}
- void initSetInt32(std::int32_t v)//should only be used in constructor or after mpz_clear has been called
+ void initSetInt32(int32_t v)//should only be used in constructor or after mpz_clear has been called
{
value->_mp_alloc=v;
- *((long int*)&(value->_mp_d))=1;
+ value->_mp_d=reinterpret_cast<mp_limb_t *>(1);
}
- void setInt32(std::int32_t v)
+ void setInt32(int32_t v)
{
assert(!hasLimbs());
value->_mp_alloc=v;
}
- std::int32_t getInt32()const
+ int32_t getInt32()const
{
assert(!hasLimbs());
return int32_t(value[0]._mp_alloc);
--- gfan0.7/src/lp_cdd.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/lp_cdd.cpp 2024-08-12 11:05:45.724320177 -0600
@@ -5,9 +5,9 @@
#include "cdd.h"
#include "cdd_f.h"
#else
-#include "cdd/setoper.h"
-#include "cdd/cdd.h"
-#include "cdd/cdd_f.h"
+#include "cddlib/setoper.h"
+#include "cddlib/cdd.h"
+#include "cddlib/cdd_f.h"
#endif
//}
#include "termorder.h"
--- gfan0.7/src/lp.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/lp.cpp 2024-08-13 10:49:50.357991909 -0600
@@ -58,7 +58,7 @@ bool LpSolver::interiorPoint(const Integ
bool LpSolver::hasInteriorPoint(const IntegerVectorList &g, bool strictlyPositive, IntegerVector const *equalitySet)
{
fprintf(stderr,"hasInteriorPoint method not supported in \"%s\" LP class\n",name());
- assert(0);
+ abort();
}
@@ -118,7 +118,7 @@ void LpSolver::dual(int n, const Integer
bool LpSolver::hasHomogeneousSolution(int n, const IntegerVectorList &inequalities, const IntegerVectorList &equations)
{
fprintf(stderr,"hasHomogeneousSolution method not supported in \"%s\" LP class\n",name());
- assert(0);
+ abort();
}
static LpSolver *soplex,*soplexCddGmp,*huber,*cdd,*cddgmp,*default_;
--- gfan0.7/src/lp_soplexcdd.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/lp_soplexcdd.cpp 2024-08-12 13:34:07.043619886 -0600
@@ -306,7 +306,7 @@ static bool isInfeasibilityCertificate(I
return true;
}
/* for(IntegerVectorList::const_iterator j=g.begin();j!=g.end();j++)
- {
+ {*/
/* double prod=0;
for(int i=0;i<work.nRows();i++)
{prod+=(*j)[i]*certificate[i];
--- gfan0.7/src/monomial.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/monomial.cpp 2024-08-12 13:41:31.558539133 -0600
@@ -5,7 +5,7 @@
Monomial::Monomial(PolynomialRing const &r,const IntegerVector &v):exponent(v),theRing(r)
{
- if(v.size()!=r.getNumberOfVariables())
+ if((int)v.size()!=r.getNumberOfVariables())
{
AsciiPrinter(Stderr).printPolynomialRing(r);
AsciiPrinter(Stderr).printVector(v);
@@ -24,7 +24,7 @@ string Monomial::toString(bool alwaysWri
const int sign=1;
bool variablePrinted=false;
- for(int i=0;i<exponent.size();i++)if(exponent[i]*sign>0)
+ for(int i=0;(size_t)i<exponent.size();i++)if(exponent[i]*sign>0)
{
s << getRing().getVariableName(i);
if(int(exponent[i]*sign)!=1)
--- gfan0.7/src/nbody.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/nbody.cpp 2024-08-13 10:50:08.557770361 -0600
@@ -16,7 +16,7 @@ static int rIndex(int i, int j, int N, b
if((I==i)&&(J==j))return r;
r++;
}
- assert(0);
+ abort();
}
static int sIndex(int i, int j, int N, bool withMasses)
--- gfan0.7/src/packedmonomial.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/packedmonomial.cpp 2024-08-13 10:50:25.380565573 -0600
@@ -18,7 +18,7 @@ vector<MonomialType> minimized(vector<Mo
{
vector<MonomialType> temp(generators);
- assert(0);
+ abort();
// sort(temp.begin(),temp.end());
/* g->sort(polynomialOrder(LexicographicTermOrder()));
--- gfan0.7/src/parser.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/parser.cpp 2024-08-13 10:50:41.716366715 -0600
@@ -637,7 +637,7 @@ Field CharacterBasedParser::parseField()
}
parserError("field",c);
- assert(0);
+ abort();
}
--- gfan0.7/src/polyhedralfan.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/polyhedralfan.cpp 2024-08-13 10:51:08.061046009 -0600
@@ -1671,7 +1671,7 @@ PolyhedralCone PolyhedralFan::coneContai
for(PolyhedralConeList::const_iterator i=cones.begin();i!=cones.end();i++)
if(i->contains(v))return i->faceContaining(v);
debug<<"Vector "<<v<<" not contained in support of fan\n";
- assert(0);
+ abort();
}
--- gfan0.7/src/polymakefile.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/polymakefile.cpp 2024-08-13 10:51:47.299568351 -0600
@@ -328,7 +328,7 @@ void PolymakeFile::writeMatrixProperty(c
IntegerMatrix PolymakeFile::readArrayArrayIntProperty(const char *p, int width)
{
- assert(0);//Not implemented yet.
+ abort();//Not implemented yet.
}
@@ -371,7 +371,7 @@ static list<int> readIntList(istream &s)
{
list<int> ret;
int c=s.peek();
- while((c>='0') && (c<='9')|| (c==' '))
+ while((c>='0' && c<='9')|| c==' ')
{
// fprintf(Stderr,"?\n");
int r;
--- gfan0.7/src/symmetry.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/symmetry.cpp 2024-08-12 11:05:45.724320177 -0600
@@ -580,7 +580,7 @@ int SymmetryGroup::orbitSize(IntegerVect
if(doesFix)numFixed++;
}
}
- return groupSize/numFixed;
+ return (numFixed>0) ? groupSize/numFixed : 0;
}
--- gfan0.7/src/vektor.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/vektor.cpp 2024-08-12 13:37:34.017788560 -0600
@@ -96,17 +96,17 @@ int gcdGFAN(int r, int s)
int gcdOfVector(IntegerVector const &v)
{
int ret=0;
- for(int i=0;i<v.size();i++)if(ret=v[i])break;
+ for(size_t i=0;i<v.size();i++)if((ret=v[i]))break;
if(ret<0)ret=-ret;
assert(ret!=0);
- for(int i=0;i<v.size();i++)ret=gcdGFAN(ret,v[i]);
+ for(size_t i=0;i<v.size();i++)ret=gcdGFAN(ret,v[i]);
return ret;
}
int gcdOfVectorCandidate(IntegerVector const &v, int ret)
{
- for(int i=0;i<v.size();i++)
+ for(size_t i=0;i<v.size();i++)
{
ret=gcdGFAN(ret,v[i]);
if(ret==1)break;
--- gfan0.7/src/vektor.h.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/vektor.h 2024-08-12 14:56:31.328176502 -0600
@@ -1,6 +1,7 @@
#ifndef VEKTOR_H_INCLUDED
#define VEKTOR_H_INCLUDED
+#include <iostream>
#include <vector>
#include <list>
#include <assert.h>
@@ -14,8 +15,6 @@ using namespace std;
//typedef signed long int int64;
typedef int64_t int64;
-void outOfRange(int i, int n);
-
/*
* TODO: in the process of making gfan a library to be used by POLYMAKE etc.
* we need to:
@@ -80,7 +79,7 @@ public:
template<class T> explicit Vektor(const Vektor<T>& c)
:v(c.size())
{
- for(int i=0;i<size();i++)v[i]=typ(c[i]);
+ for(size_t i=0;i<size();i++)v[i]=typ(c[i]);
}
//--------
@@ -88,10 +87,13 @@ public:
//--------
typ& operator[](int n)
{
- if(!(n>=0 && n<v.size()))outOfRange(n,v.size());
+ if(!(n>=0 && (size_t)n<v.size())) {
+ std::cerr<<"Index out of range. i="<<n<<" n="<<v.size()<<std::endl;
+ assert(0);
+ }
return (v[n]);
}
- const typ& operator[](int n)const{assert(n>=0 && n<v.size());return (v[n]);}
+ const typ& operator[](int n)const{assert(n>=0 && (size_t)n<v.size());return (v[n]);}
const typ& UNCHECKEDACCESS(int n)const{return (v[n]);}
typ& UNCHECKEDACCESS(int n){return (v[n]);}
@@ -100,7 +102,7 @@ public:
//-------------
unsigned int size()const{return v.size();};
void resize(int n){v.resize(n,0);};
- void grow(int i){if(size()<i)resize(i);}
+ void grow(int i){if(size()<(size_t)i)resize(i);}
void push_back(typ a)
{
v.push_back(a);
@@ -117,7 +119,7 @@ public:
{
if(size()<b.size())return true;
if(size()>b.size())return false;
- for(int i=0;i<size();i++)
+ for(size_t i=0;i<size();i++)
{
if(v[i]<b[i])return true;
if(b[i]<v[i])return false;
@@ -128,10 +130,10 @@ public:
//-----------------
// Arithmetic fast
//-----------------
- typ sum()const{typ f=0;for(int i=0;i<size();i++)f+=v[i];return f;};
- Vektor& operator+=(const Vektor& q){assert(size()==q.size());for(int i=0;i<size();i++)v[i]+=q.v[i];return *this;}
- Vektor& operator-=(const Vektor& q){assert(size()==q.size());for(int i=0;i<size();i++)v[i]-=q.v[i];return *this;}
- inline friend typ dot(const Vektor& p, const Vektor& q){assert(p.size()==q.size());typ s=0;for(int i=0;i<p.size();i++)s+=p[i]*q[i];return s;}
+ typ sum()const{typ f=0;for(size_t i=0;i<size();i++)f+=v[i];return f;};
+ Vektor& operator+=(const Vektor& q){assert(size()==q.size());for(size_t i=0;i<size();i++)v[i]+=q.v[i];return *this;}
+ Vektor& operator-=(const Vektor& q){assert(size()==q.size());for(size_t i=0;i<size();i++)v[i]-=q.v[i];return *this;}
+ inline friend typ dot(const Vektor& p, const Vektor& q){assert(p.size()==q.size());typ s=0;for(size_t i=0;i<p.size();i++)s+=p[i]*q[i];return s;}
// inline friend int64 dotLong(const Vektor& p, const Vektor& q){assert(p.size()==q.size());int64 s=0;for(int i=0;i<p.size();i++)s+=(int64)p[i]*(int64)q[i];return s;}
inline friend int64 dotLong(const Vektor& p, const Vektor& q)
{
@@ -186,50 +188,50 @@ public:
dest[*p]=*s;
}
- bool operator==(const Vektor & q)const{if(size()!=q.size())return false;for(int i=0;i<size();i++)if(v[i]!=q[i])return false;return true;}
+ bool operator==(const Vektor & q)const{if(size()!=q.size())return false;for(size_t i=0;i<size();i++)if(v[i]!=q[i])return false;return true;}
bool operator!=(const Vektor & q)const {return !(operator==(q));}
bool isZero() const
{
- int n=v.size();
- for(int i=0;i<n;i++)if(v[i]!=0)return 0;
+ size_t n=v.size();
+ for(size_t i=0;i<n;i++)if(v[i]!=0)return 0;
return 1;
}
bool isPositive() const
{
- int n=v.size();
- for(int i=0;i<n;i++)if(v[i]<=0)return 0;
+ size_t n=v.size();
+ for(size_t i=0;i<n;i++)if(v[i]<=0)return 0;
return 1;
}
bool isNonNegative() const
{
- int n=v.size();
- for(int i=0;i<n;i++)if(v[i]<0)return 0;
+ size_t n=v.size();
+ for(size_t i=0;i<n;i++)if(v[i]<0)return 0;
return 1;
}
int max()const
{
int ret=-0x7fffffff; //not completely correct, but kind of works for 64bit
- for(int i=0;i<v.size();i++)if(ret<v[i])ret=v[i];
+ for(size_t i=0;i<v.size();i++)if(ret<v[i])ret=v[i];
return ret;
}
int argMax()const
{
int iret=-1;
int ret=-0x7fffffff; //not completely correct, but kind of works for 64bit
- for(int i=0;i<v.size();i++)if(ret<v[i]){ret=v[i];iret=i;}
+ for(size_t i=0;i<v.size();i++)if(ret<v[i]){ret=v[i];iret=i;}
return iret;
}
int min()const
{
int ret=0x7fffffff;
- for(int i=0;i<v.size();i++)if(ret>v[i])ret=v[i];
+ for(size_t i=0;i<v.size();i++)if(ret>v[i])ret=v[i];
return ret;
}
typ infinityNorm()const
{
typ a=0;
typ b=0;
- for(int i=0;i<v.size();i++)
+ for(size_t i=0;i<v.size();i++)
{
if(a<v[i])a=v[i];
if(b>v[i])b=v[i];
@@ -242,7 +244,7 @@ public:
bool aOK=true;
bool bOK=true;
- for(int i=0;i<v.size();i++)
+ for(size_t i=0;i<v.size();i++)
{
aOK&=(v[i]<k);
bOK&=(v[i]>-k);
@@ -257,9 +259,9 @@ public:
typ pq=dot(p,q);
return pq*pq==pp*qq;
*/
- int n=p.size();
+ size_t n=p.size();
assert(n==q.size());
- int i;
+ size_t i;
for(i=0;i<n;i++)
{
if(p.v[i])break;
@@ -268,7 +270,7 @@ public:
if(q.v[i]==0)return q.isZero();
int64 a=p.v[i];
int64 b=q.v[i];
- for(int j=0;j<n;j++)
+ for(size_t j=0;j<n;j++)
if(a*q.v[j]!=b*p.v[j])return false;
return true;
}
@@ -277,15 +279,15 @@ public:
// Arithmetic slow
//-----------------
inline friend Vektor operator-(const Vektor& q){return -1*q;};
- inline friend Vektor operator*(typ s, const Vektor& q){Vektor p=q;for(int i=0;i<q.size();i++)p[i]*=s;return p;}
- inline friend Vektor operator/(const Vektor& q, typ s){Vektor p=q;for(int i=0;i<q.size();i++)p[i]/=s;return p;}
- inline friend Vektor operator*(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)p1.v[i]*=q.v[i];return p1;}
+ inline friend Vektor operator*(typ s, const Vektor& q){Vektor p=q;for(size_t i=0;i<q.size();i++)p[i]*=s;return p;}
+ inline friend Vektor operator/(const Vektor& q, typ s){Vektor p=q;for(size_t i=0;i<q.size();i++)p[i]/=s;return p;}
+ inline friend Vektor operator*(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(size_t i=0;i<p.size();i++)p1.v[i]*=q.v[i];return p1;}
// inline friend Vektor operator+(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)p1[i]+=q[i];return p1;}
- inline friend Vektor operator+(const Vektor& p, const Vektor& q){if(p.size()!=q.size()){fprintf(stderr,"%i %i\n",p.size(),q.size());assert(p.size()==q.size());};Vektor p1=p;for(int i=0;i<p.size();i++)p1[i]+=q[i];return p1;}
- inline friend Vektor operator-(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)p1[i]-=q[i];return p1;}
- friend Vektor max(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)if(p1[i]<q[i])p1[i]=q[i];return p1;}
- friend Vektor min(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)if(p1[i]>q[i])p1[i]=q[i];return p1;}
- friend Vektor coordinatewiseProduct(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1(q.size());for(int i=0;i<p.size();i++)p1[i]=p[i]*q[i];return p1;}
+ inline friend Vektor operator+(const Vektor& p, const Vektor& q){if(p.size()!=q.size()){fprintf(stderr,"%i %i\n",p.size(),q.size());assert(p.size()==q.size());};Vektor p1=p;for(size_t i=0;i<p.size();i++)p1[i]+=q[i];return p1;}
+ inline friend Vektor operator-(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(size_t i=0;i<p.size();i++)p1[i]-=q[i];return p1;}
+ friend Vektor max(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(size_t i=0;i<p.size();i++)if(p1[i]<q[i])p1[i]=q[i];return p1;}
+ friend Vektor min(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(size_t i=0;i<p.size();i++)if(p1[i]>q[i])p1[i]=q[i];return p1;}
+ friend Vektor coordinatewiseProduct(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1(q.size());for(size_t i=0;i<p.size();i++)p1[i]=p[i]*q[i];return p1;}
//------------------
// Monomial related
@@ -293,8 +295,8 @@ public:
int divides(const Vektor& q) const
{
assert(size()==q.size());
- int n=v.size();
- for(int i=0;i<n;i++)
+ size_t n=v.size();
+ for(size_t i=0;i<n;i++)
{
if(v[i]>0)if(q.v[i]<v[i])return 0;
}
@@ -303,14 +305,14 @@ public:
inline friend bool relativelyPrime(const Vektor& p, const Vektor& q)
{
assert(p.size()==q.size());
- int n=p.size();
- for(int t=0;t<n;t++)if((p[t]>0)&&(q[t]>0)) return false;
+ size_t n=p.size();
+ for(size_t t=0;t<n;t++)if((p[t]>0)&&(q[t]>0)) return false;
return true;
}
Vektor supportVector()const
{
Vektor r(v.size());
- for(int i=0;i<size();i++)
+ for(size_t i=0;i<size();i++)
r[i]=(v[i]!=0);
return r;
}
@@ -321,7 +323,7 @@ public:
Vektor subvector(int begin, int end)const
{
assert(begin>=0);
- assert(end<=size());
+ assert((size_t)end<=size());
assert(end>=begin);
Vektor ret(end-begin);
for(int i=0;i<end-begin;i++)
@@ -339,36 +341,36 @@ public:
{
Vektor ret(subset.sum());
int i=0;
- for(int j=0;j<v.size();j++)if(subset[j])ret[i++]=v[j];
+ for(size_t j=0;j<v.size();j++)if(subset[j])ret[i++]=v[j];
return ret;
}
Vektor expandedBoolean(Vektor<int> const &subset)const // Inverse of the above, except that unknown entries are set to zero.
{
Vektor ret(subset.size());
- int i=0;
- for(int j=0;j<subset.size();j++)
+ size_t i=0;
+ for(size_t j=0;j<subset.size();j++)
if(subset[j])ret[j]=v[i++];
return ret;
}
friend Vektor concatenation(Vektor const &a, Vektor const &b)
{
Vektor ret(a.size()+b.size());
- for(int i=0;i<a.size();i++)ret[i]=a[i];
- for(int i=0;i<b.size();i++)ret[i+a.size()]=b[i];
+ for(size_t i=0;i<a.size();i++)ret[i]=a[i];
+ for(size_t i=0;i<b.size();i++)ret[i+a.size()]=b[i];
return ret;
}
Vektor expanded(int newSize, vector<int> const &positions)
{
Vektor ret(newSize);
assert(positions.size()==size());
- for(int i=0;i<size();i++)ret[positions[i]]=v[i];
+ for(size_t i=0;i<size();i++)ret[positions[i]]=v[i];
return ret;
}
Vektor withIthCoordinateRemoved(int i)const
{
Vektor ret(size()-1);
for(int j=0;j<i;j++)ret[j]=v[j];
- for(int j=i+1;j<size();j++)ret[j-1]=v[j];
+ for(int j=i+1;(size_t)j<size();j++)ret[j-1]=v[j];
return ret;
}
Vektor withIthCoordinateInserted(int i, const typ &a)const
@@ -376,7 +378,7 @@ public:
Vektor ret(size()+1);
for(int j=0;j<i;j++)ret[j]=v[j];
ret[i]=a;
- for(int j=i;j<size();j++)ret[j+1]=v[j];
+ for(int j=i;(size_t)j<size();j++)ret[j+1]=v[j];
return ret;
}
@@ -386,7 +388,7 @@ public:
int indexOfLargestNonzeroEntry()const
{
int ret=-1;
- for(int i=0;i<v.size();i++)
+ for(int i=0;(size_t)i<v.size();i++)
{
if(v[i])ret=i;
}
@@ -395,20 +397,20 @@ public:
Vektor supportIndices()const
{
Vektor ret(0);
- for(int i=0;i<v.size();i++)
+ for(int i=0;(size_t)i<v.size();i++)
if(v[i]!=0)ret.push_back(i);
return ret;
}
Vektor supportAsZeroOneVector()const
{
Vektor ret(v.size());
- for(int i=0;i<v.size();i++)ret[i]=bool(v[i]);
+ for(size_t i=0;i<v.size();i++)ret[i]=bool(v[i]);
return ret;
}
void calcsupport(void)
{
support=0;
- for(int i=0;i<v.size();i++)support=(support<<1)|(((v[i]>0)==true)&1);
+ for(size_t i=0;i<v.size();i++)support=(support<<1)|(((v[i]>0)==true)&1);
}
};
--- gfan0.7/src/wallideal.cpp.orig 2024-08-12 10:00:15.000000000 -0600
+++ gfan0.7/src/wallideal.cpp 2024-08-12 13:30:10.087861417 -0600
@@ -951,7 +951,7 @@ bool fastIsFacet(IntegerVectorList const
}
-
+*/
/* IntegerVector maxAttained(n);
IntegerVector minAttained(n);
for(IntegerVectorList::const_iterator k=tempNormals.begin();k!=tempNormals.end();k++)

View File

@ -1,92 +0,0 @@
[ 8s] app_fancoarsening.cpp:41:3: warning: no return statement in function returning non-void [-Wreturn-type]
[ 13s] app_main.cpp:184:12: warning: deleting object of polymorphic class type 'EnumerationAlgorithm' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
[ 13s] delete rs; //<--- In next release, make the class virtual
[ 15s] app_main.cpp:208:12: warning: deleting object of abstract class type 'EnumerationFilePrinter' which has non-virtual destructor will cause undefined behavior [-Wdelete-non-virtual-dtor]
[ 15s] delete ep;//<--- In next release, make the class virtual
[ 18s] app_test.cpp:103:1: warning: no return statement in function returning non-void [-Wreturn-type]
[ 20s] app_tropicalhypersurfacereconstruction.cpp:57:3: warning: no return statement in function returning non-void [-Wreturn-type]
[ 27s] gfanlib_tropicalhomotopy.h:457:8: warning: operation on 'numberToDrop' may be undefined [-Wsequence-point]
[ 27s] int numberToDrop=(subconfigurationIndex!=0) ? numberToDrop=k+1 : 0;
---
src/app_fancoarsening.cpp | 1 +
src/app_test.cpp | 4 ++--
src/app_tropicalhypersurfacereconstruction.cpp | 1 +
src/enumeration.h | 3 +++
src/gfanlib_tropicalhomotopy.h | 2 +-
5 files changed, 8 insertions(+), 3 deletions(-)
Index: gfan0.6.2/src/app_fancoarsening.cpp
===================================================================
--- gfan0.6.2.orig/src/app_fancoarsening.cpp
+++ gfan0.6.2/src/app_fancoarsening.cpp
@@ -37,6 +37,7 @@ public:
{
int i=0;
+ return {};
}
Index: gfan0.6.2/src/app_test.cpp
===================================================================
--- gfan0.6.2.orig/src/app_test.cpp
+++ gfan0.6.2/src/app_test.cpp
@@ -98,8 +98,8 @@ int testIntegers()
b=a;
a=c;
cerr<<a<<endl;
- }
- return 0;*/
+ }*/
+ return 0;
}
int testGfanLib()
{
Index: gfan0.6.2/src/app_tropicalhypersurfacereconstruction.cpp
===================================================================
--- gfan0.6.2.orig/src/app_tropicalhypersurfacereconstruction.cpp
+++ gfan0.6.2/src/app_tropicalhypersurfacereconstruction.cpp
@@ -53,6 +53,7 @@ public:
{
int i=0;
+ return {};
}
Index: gfan0.6.2/src/enumeration.h
===================================================================
--- gfan0.6.2.orig/src/enumeration.h
+++ gfan0.6.2/src/enumeration.h
@@ -25,6 +25,8 @@ class EnumerationTargetCollector: public
class EnumerationPrinter: public EnumerationTarget
{
+ public:
+ virtual ~EnumerationPrinter() = default;
};
@@ -60,6 +62,7 @@ class EnumerationAlgorithm
void targetEndEnumeration(){if(target)target->endEnumeration();}
bool targetBasis(const PolynomialSet &groebnerBasis){bool ret=true;if(target)ret=target->basis(groebnerBasis);printProgress();return ret;}
public:
+ virtual ~EnumerationAlgorithm() = default;
EnumerationAlgorithm(){target=0;progressCounter=0;}
void setEnumerationTarget(EnumerationTarget *target){this->target=target;}
virtual void enumerate(const PolynomialSet &groebnerBasis){}
Index: gfan0.6.2/src/gfanlib_tropicalhomotopy.h
===================================================================
--- gfan0.6.2.orig/src/gfanlib_tropicalhomotopy.h
+++ gfan0.6.2/src/gfanlib_tropicalhomotopy.h
@@ -454,7 +454,7 @@ template<class mvtyp, class mvtypDouble,
//chioices are "relative" so no update is needed.
choices=parent.choices;
- int numberToDrop=(subconfigurationIndex!=0) ? numberToDrop=k+1 : 0;
+ int numberToDrop=(subconfigurationIndex!=0) ? k+1 : 0;
choices[subconfigurationIndex-1].first-=numberToDrop;
choices[subconfigurationIndex-1].second-=numberToDrop;

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Sep 10 09:05:35 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.7
* Introduction of ``_tropicalprevariety`` which is much faster
than the old ``_tropicalintersection``.
- Add gfan-c++20.patch, gfan-gcd.patch, gfan-multiplicities.patch,
gfan-odr.patch, gfan-soplex.patch, gfan-warning.patch
- Delete gfan-warnings.diff & cddlib.patch
(replaced by gfan-warning.patch)
-------------------------------------------------------------------
Tue Jul 13 09:09:06 UTC 2021 - Alois Wohlschlager <alois1@gmx-topmail.de>

View File

@ -17,18 +17,20 @@
Name: gfan
Version: 0.6.2
Version: 0.7
Release: 0
Summary: Calculation of Gröbner fans
License: GPL-2.0-only
Group: Productivity/Scientific/Math
URL: http://home.imf.au.dk/jensen/software/gfan/gfan.html
Source: http://home.imf.au.dk/jensen/software/gfan/%name%version.tar.gz
URL: https://math.au.dk/~jensen/software/gfan/gfan.html
Source: https://math.au.dk/~jensen/software/gfan/%name%version.tar.gz
Patch1: gfan-automake.diff
Patch2: gfan-warnings.diff
Patch3: cddlib.patch
Patch4: gfan-odr.patch
# From fedora
Patch2: gfan-warning.patch
Patch3: gfan-soplex.patch
Patch4: gfan-c++20.patch
Patch5: gfan-gcd.patch
Patch6: gfan-multiplicities.patch
BuildRequires: automake
BuildRequires: cddlib-devel
BuildRequires: gcc-c++
@ -58,11 +60,10 @@ varieties. These are polyhedral fans associated to polynomial ideals.
%build
autoreconf -fi
export CXXFLAGS="%optflags -Wno-sign-compare -Wno-reorder -Wno-unused -Wno-comment -Wno-misleading-indentation -std=gnu++11"
%configure
make %{?_smp_mflags} V=1
%make_build V=1
%if 0%{?with_pdf}
make -C doc %{?_smp_mflags}
%make_build -C doc
%endif
%install

Binary file not shown.

BIN
gfan0.7.tar.gz Normal file

Binary file not shown.