diff --git a/Formula/gfan.rb b/Formula/gfan.rb index 7801821..20b0d09 100644 --- a/Formula/gfan.rb +++ b/Formula/gfan.rb @@ -1,10 +1,9 @@ class Gfan < Formula desc "Grobner fans and tropical varieties" homepage "https://users-math.au.dk/~jensen/software/gfan/gfan.html" - url "https://users-math.au.dk/~jensen/software/gfan/gfan0.6.2.tar.gz" - sha256 "a674d5e5dc43634397de0d55dd5da3c32bd358d05f72b73a50e62c1a1686f10a" + url "https://users-math.au.dk/~jensen/software/gfan/gfan0.7.tar.gz" + sha256 "ab833757e1e4d4a98662f4aa691394013ea9a226f6416b8f8565356d6fcc989e" license "GPL-2.0-or-later" - revision 11 bottle do root_url "https://ghcr.io/v2/macaulay2/tap" @@ -25,11 +24,6 @@ class Gfan < Formula depends_on "cddlib" depends_on "gmp" - patch do - url "https://raw.githubusercontent.com/Macaulay2/M2/d51564127d757a3132684e9730f4085cb89297bb/M2/libraries/gfan/patch-0.6.2" - sha256 "9ebbf25e6de16baec877050bef69c85504e7bfa81e79407c2ab00ea4433e838c" - end - patch :DATA def install @@ -55,31 +49,332 @@ def install __END__ -diff --git a/Makefile-orig b/Makefile -index 737208abfb..52e010e0b3 100644 +diff --git a/Makefile b/Makefile +index 67c8164..0c9bbf2 100644 --- a/Makefile +++ b/Makefile -@@ -110,15 +110,15 @@ MKDIR=mkdir -p - PREFIX = +@@ -117,11 +117,6 @@ PREFIX = SHELL = /bin/sh #ARCH = LINUX + -CC = $(PREFIX)gcc -CLINKER = $(CC) -CXX = $(PREFIX)g++ -CCLINKER = $(CXX) -+#CC = $(PREFIX)gcc -+#CLINKER = $(CC) -+#CXX = $(PREFIX)g++ -+#CCLINKER = $(CXX) - #OPTFLAGS = -O2 -DGMPRATIONAL -DNDEBUG - # Note that gcc produces wrong code with -O3 --OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O2 #-O3 -fno-guess-branch-probability #-DNDEBUG -+#OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O2 #-O3 -fno-guess-branch-probability #-DNDEBUG - #OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O3 -mavx -msse2 -finline-limit=1000 -ffast-math -Wuninitialized # -fno-guess-branch-probability #-DNDEBUG -ftree-vectorizer-verbose=2 --#OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O1 -fno-guess-branch-probability -+OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O1 -fno-guess-branch-probability - #-DNDEBUG - #OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O3 -mavx -msse2 -ftree-vectorizer-verbose=2 -finline-limit=1000 -ffast-math #-DNDEBUG - #OPTFLAGS = -DGMPRATIONAL -Wuninitialized -fno-omit-frame-pointer -O3 -mavx -msse2 -ftree-vectorizer-verbose=2 -march=native -unroll-loops --param max-unroll-times=4 -ffast-math #-DNDEBUG +- + #CC = $(PREFIX)gcc-8.1 + #CLINKER = $(CC) + #CXX = $(PREFIX)g++-8.1 +@@ -420,9 +415,9 @@ EXECS = $(MAIN) + # (compiling with gcc version 4.7.2 and running gfan _tropicaltraverse on a starting cone for Grassmann3_7) + # Either this is a bug in the code or in the compiler. The bug disappears by compiling with -fno-guess-branch-probability + src/symmetrictraversal.o: src/symmetrictraversal.cpp +- $(CXX) $(CFLAGS) -fno-guess-branch-probability -c src/symmetrictraversal.cpp -o src/symmetrictraversal.o ++# $(CXX) $(CFLAGS) -fno-guess-branch-probability -c src/symmetrictraversal.cpp -o src/symmetrictraversal.o + # If compiling with clang, use the line below instead: +-# $(CXX) $(CFLAGS) -c src/symmetrictraversal.cpp -o src/symmetrictraversal.o ++ $(CXX) $(CFLAGS) -c src/symmetrictraversal.cpp -o src/symmetrictraversal.o + + # Define suffixes to make the program compile on legolas.imf.au.dk : + .SUFFIXES: .o .cpp .c +diff --git a/src/application.cpp b/src/application.cpp +index 77f830b..baf3589 100644 +--- a/src/application.cpp ++++ b/src/application.cpp +@@ -567,7 +567,7 @@ void Application::makeSymbolicLinks(const char *name, bool all, const char *path + if(strlen(p->name())>0) + { + char c[1024]; +- sprintf(c,"ln -s %s%s %s%s%s\n",path,name,path,name,p->name()); ++ sprintf(c,"ln -sf %s%s %s%s%s\n",path,name,path,name,p->name()); + fprintf(stderr,"%s",c); + int err=system(c); + assert(err==0); +diff --git a/src/enumeration.cpp b/src/enumeration.cpp +index 44d0a4f..6d3870e 100644 +--- a/src/enumeration.cpp ++++ b/src/enumeration.cpp +@@ -14,7 +14,7 @@ EnumerationFilePrinter::EnumerationFilePrinter(): + + EnumerationFilePrinter::~EnumerationFilePrinter() + { +- assert(file==0); ++ // assert(file==0); + } + + +diff --git a/src/enumeration.h b/src/enumeration.h +index b0bd187..d91c9ff 100644 +--- a/src/enumeration.h ++++ b/src/enumeration.h +@@ -36,7 +36,7 @@ class EnumerationFilePrinter: public EnumerationPrinter + FILE *file; + public: + EnumerationFilePrinter(); +- ~EnumerationFilePrinter(); ++ virtual ~EnumerationFilePrinter(); + + void open(std::string filename); + void open(FILE *file); +diff --git a/src/field.h b/src/field.h +index 866be22..7df1600 100644 +--- a/src/field.h ++++ b/src/field.h +@@ -208,6 +208,7 @@ class FieldElementImplementation + { + fprintf(stderr,"*this is not in Z/pZ.\n"); + assert(0); ++ exit(0); + } + virtual bool isInteger()const + { +@@ -223,6 +224,7 @@ class FieldElementImplementation + Field& operator=(const Field& a) + { + assert(0); ++ exit(1); + }//assignment + }; + +@@ -271,7 +273,8 @@ class FieldImplementation + virtual FieldElement random() + { + assert(0); +- } ++ exit(1); ++ } + virtual int getCharacteristic()const=0; + virtual const char *name()=0; + virtual std::string toString()const=0; +diff --git a/src/field_rationalfunctions2.cpp b/src/field_rationalfunctions2.cpp +index 4e80c5a..ccc6ae9 100644 +--- a/src/field_rationalfunctions2.cpp ++++ b/src/field_rationalfunctions2.cpp +@@ -524,6 +524,7 @@ class FieldElementRationalFunction2 : public FieldElementImplementation + + return sign+string("{").append(s,startIndex,slashIndex-startIndex)+string("\\over ").append(s,slashIndex+1,s.length()-slashIndex-1)+string("}"); + */ ++ exit(1); + } + + std::string toString(bool writeIfOne=true, bool alwaysWriteSign=false, bool latexMode=false /*, bool mathMode=true*/) const +diff --git a/src/field_rationals.cpp b/src/field_rationals.cpp +index 30a92f6..06c95c9 100644 +--- a/src/field_rationals.cpp ++++ b/src/field_rationals.cpp +@@ -398,7 +398,7 @@ const char *FieldRationalsImplementation::name() + /*FieldRationals::FieldRationals(): + Field(new FieldRationalsImplementation()) + { +- /* fprintf(Stderr,"Adding field rationals\n"); ++ fprintf(Stderr,"Adding field rationals\n"); + next=list; + list=this; + */ +diff --git a/src/gfanlib_circuittableint.h b/src/gfanlib_circuittableint.h +index 2b5ced4..609d2d2 100644 +--- a/src/gfanlib_circuittableint.h ++++ b/src/gfanlib_circuittableint.h +@@ -25,6 +25,7 @@ namespace gfan{ + template struct MyMakeUnsigned; + template <> struct MyMakeUnsigned{typedef unsigned int type;}; + template <> struct MyMakeUnsigned{typedef unsigned long int type;}; ++ template <> struct MyMakeUnsigned{typedef unsigned long long int type;}; + template <> struct MyMakeUnsigned<__int128>{typedef unsigned __int128 type;}; + + class MVMachineIntegerOverflow: public std::exception +@@ -239,6 +240,17 @@ static my256s extMul(__int128_t a, __int128_t b) + return my256s(r); + } + ++static my256s extMul(long long int a, long long int b) ++{ ++// std::cerr<<"mul"<) +- } ++#endif + int D=std::numeric_limits::digits; + if(D==0){D=127;}//fixes bug in gcc-8.1 + bool doesOverflow=(((word)t.v)==(word{1}<<(D-1)));// What is the purpose of this line. Do we really want to subtract 1? That seems wrong since word is signed. Look at comment below +diff --git a/src/gfanlib_z.h b/src/gfanlib_z.h +index f56597c..5a62076 100644 +--- a/src/gfanlib_z.h ++++ b/src/gfanlib_z.h +@@ -8,6 +8,7 @@ + #ifndef LIB_Z_H_ + #define LIB_Z_H_ + ++#include + #include + #include + #include +diff --git a/src/gmpallocator.cpp b/src/gmpallocator.cpp +index e308412..07c6b74 100644 +--- a/src/gmpallocator.cpp ++++ b/src/gmpallocator.cpp +@@ -29,7 +29,7 @@ static inline int bufNum(int size) + { + ret++; + if(ret>=(NBUCKETSGMP))return -1; +- size>>1; ++ size>>=1; + } + return ret; + } +diff --git a/src/lp.cpp b/src/lp.cpp +index 744e2a9..420b853 100644 +--- a/src/lp.cpp ++++ b/src/lp.cpp +@@ -59,6 +59,7 @@ bool LpSolver::hasInteriorPoint(const IntegerVectorList &g, bool strictlyPositiv + { + fprintf(stderr,"hasInteriorPoint method not supported in \"%s\" LP class\n",name()); + assert(0); ++ exit(1); + } + + +@@ -119,6 +120,7 @@ bool LpSolver::hasHomogeneousSolution(int n, const IntegerVectorList &inequaliti + { + fprintf(stderr,"hasHomogeneousSolution method not supported in \"%s\" LP class\n",name()); + assert(0); ++ exit(1); + } + + static LpSolver *soplex,*soplexCddGmp,*huber,*cdd,*cddgmp,*default_; +diff --git a/src/nbody.cpp b/src/nbody.cpp +index e6d2e6e..3384bb0 100644 +--- a/src/nbody.cpp ++++ b/src/nbody.cpp +@@ -17,6 +17,7 @@ static int rIndex(int i, int j, int N, bool withMasses) + r++; + } + assert(0); ++ exit(1); + } + + static int sIndex(int i, int j, int N, bool withMasses) +diff --git a/src/packedmonomial.cpp b/src/packedmonomial.cpp +index 65a9242..37404e6 100644 +--- a/src/packedmonomial.cpp ++++ b/src/packedmonomial.cpp +@@ -39,6 +39,7 @@ vector minimized(vector const &generators) + + *g=ret; + */ ++ exit(1); + } + + +diff --git a/src/parser.cpp b/src/parser.cpp +index 8c09b1a..ed807f8 100644 +--- a/src/parser.cpp ++++ b/src/parser.cpp +@@ -638,6 +638,7 @@ Field CharacterBasedParser::parseField() + + parserError("field",c); + assert(0); ++ exit(1); + } + + +diff --git a/src/polyhedralfan.cpp b/src/polyhedralfan.cpp +index e62cae4..90eae40 100644 +--- a/src/polyhedralfan.cpp ++++ b/src/polyhedralfan.cpp +@@ -1672,6 +1672,7 @@ PolyhedralCone PolyhedralFan::coneContaining(IntegerVector const &v)const + if(i->contains(v))return i->faceContaining(v); + debug<<"Vector "< readIntList(istream &s) + { + list ret; + int c=s.peek(); +- while((c>='0') && (c<='9')|| (c==' ')) ++ while(((c>='0') && (c<='9'))|| (c==' ')) + { + // fprintf(Stderr,"?\n"); + int r; +diff --git a/src/polynomialgcd.cpp b/src/polynomialgcd.cpp +index 82aea06..14cb528 100644 +--- a/src/polynomialgcd.cpp ++++ b/src/polynomialgcd.cpp +@@ -618,7 +618,7 @@ Polynomial NonMonomialPolynomialGCDForZ(PolynomialSet p) + if(1) { + static int i; + i++; +- if((i==1000)) ++ if(i==1000) + { + // debug< + #include + ++#include "log.h" // include last, because it defines a macro "log2" also defined as a function in math.h ++ + using namespace std; + + Timer* Timer::timers; +diff --git a/src/vektor.cpp b/src/vektor.cpp +index d17579a..63e39f0 100644 +--- a/src/vektor.cpp ++++ b/src/vektor.cpp +@@ -96,7 +96,7 @@ int gcdGFAN(int r, int s) + int gcdOfVector(IntegerVector const &v) + { + int ret=0; +- for(int i=0;i