Import r28 from science/gfan

This commit is contained in:
Jan Engelhardt 2024-09-10 11:06:42 +02:00
commit 3ddbe9d277
7 changed files with 452 additions and 0 deletions

74
cddlib.patch Normal file
View File

@ -0,0 +1,74 @@
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"

54
gfan-automake.diff Normal file
View File

@ -0,0 +1,54 @@
From: Jan Engelhardt <jengelh@medozas.de>
Date: 2011-09-27 03:33:14.793222451 +0200
Upstream: dead?
Use much simpler Makefiles.
---
Makefile.am | 1 +
configure.ac | 6 ++++++
src/Makefile.am | 20 ++++++++++++++++++++
3 files changed, 27 insertions(+)
Index: gfan0.6.2/Makefile.am
===================================================================
--- /dev/null
+++ gfan0.6.2/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=src
Index: gfan0.6.2/configure.ac
===================================================================
--- /dev/null
+++ gfan0.6.2/configure.ac
@@ -0,0 +1,6 @@
+AC_INIT([gfan], [0.6.2])
+AM_INIT_AUTOMAKE([-Wall foreign])
+AC_PROG_INSTALL
+AC_PROG_CXX
+AC_CONFIG_FILES([Makefile src/Makefile])
+AC_OUTPUT
Index: gfan0.6.2/src/Makefile.am
===================================================================
--- /dev/null
+++ gfan0.6.2/src/Makefile.am
@@ -0,0 +1,20 @@
+AM_CPPFLAGS = -DGMPRATIONAL
+AM_CXXFLAGS = -Wuninitialized
+bin_PROGRAMS = gfan
+gfan_SOURCES = \
+app_buchberger.cpp app_chowbetti.cpp app_combinerays.cpp app_commonrefinement.cpp app_composepermutations.cpp app_debug.cpp app_doesidealcontain.cpp app_evaluate.cpp app_exponentlattice.cpp app_facets.cpp app_fancoarsening.cpp app_fancones.cpp app_fanhomology.cpp app_fansubfan.cpp \
+app_fiberpolytope.cpp app_genericlinearchange.cpp app_groebnercone.cpp app_groebnerfan.cpp app_homogeneityspace.cpp app_homogenize.cpp app_idealintersection.cpp app_idealproduct.cpp app_initialdeterminant.cpp app_initialforms.cpp app_integerfactorization.cpp app_integergb.cpp \
+app_interactive.cpp app_intsinpolytope.cpp app_isbalanced.cpp app_isconnected.cpp app_isgroebnerbasis.cpp app_ismarkedgroebnerbasis.cpp app_issmooth.cpp app_krulldimension.cpp app_latticeideal.cpp app_lattice.cpp app_leadingterms.cpp app_librarytest.cpp application.cpp app_link.cpp \
+app_lll.cpp app_lpsolve.cpp app_main.cpp app_markpolynomialset.cpp app_matrixproduct.cpp app_minimalassociatedprimes.cpp app_minkowski.cpp app_minors.cpp app_mixedvolume.cpp app_multiplymatrix.cpp app_nbody.cpp app_normalfancleanup.cpp app_padic.cpp app_pointconfiguration.cpp \
+app_polynomialsetunion.cpp app_polytopealgebra.cpp app_product.cpp app_randompolynomials.cpp app_realroots.cpp app_regularsubdivision.cpp app_render.cpp app_renderstaircase.cpp app_representatives.cpp app_resultantfan.cpp app_saturation.cpp app_scarfcomplex.cpp \
+app_scarfisgeneric.cpp app_scarfvisualize.cpp app_secondaryfan.cpp app_smalessixth2.cpp app_smalessixth.cpp app_spolynomial.cpp app_stats.cpp app_sturmsequence.cpp app_substitute.cpp app_supportindices.cpp app_symmetries.cpp app_test.cpp app_tolatex.cpp app_topolyhedralfan.cpp \
+app_transposematrix.cpp app_traversetropicalintersection.cpp app_triangulate.cpp app_tropicalbasis.cpp app_tropicalbruteforce.cpp app_tropicalcurve.cpp app_tropicalevaluation.cpp app_tropicalfunction.cpp app_tropicalhomotopy.cpp app_tropicalhypersurface.cpp \
+app_tropicalhypersurfacereconstruction.cpp app_tropicalimage.cpp app_tropicalintersection.cpp app_tropicallifting.cpp app_tropicallinearspace.cpp app_tropicalmultiplicity.cpp app_tropicalrank.cpp app_tropicalstartingcone.cpp app_tropicaltraverse.cpp \
+app_tropicalvarietyspan.cpp app_tropicalweildivisor.cpp app_volume.cpp app_walk.cpp app_weightvector.cpp bergman.cpp binomial.cpp breadthfirstsearch.cpp bsptree.cpp buchberger.cpp codimoneconnectedness.cpp continuedfractions.cpp determinant.cpp determinantpoly.cpp dimension.cpp \
+division.cpp enumeration.cpp ep_standard.cpp ep_xfig.cpp fieldlp.cpp field.cpp field_rationalfunctions2.cpp field_rationalfunctions.cpp field_rationals.cpp field_zmodpz.cpp ge_gfan.cpp genericwalk.cpp gfanapplication.cpp gfanlib_circuittableint.cpp gfanlib_mixedvolume.cpp \
+gfanlib_paralleltraverser.cpp gfanlib_polyhedralfan.cpp gfanlib_polymakefile.cpp gfanlib_symmetriccomplex.cpp gfanlib_symmetry.cpp gfanlib_traversal.cpp gfanlib_zcone.cpp gfanlib_zfan.cpp gmpallocator.cpp graph.cpp groebnerengine.cpp halfopencone.cpp integergb.cpp intsinpolytope.cpp \
+latticeideal.cpp lattice.cpp linalgfloat.cpp linalg.cpp lll.cpp log.cpp lp_cdd.cpp lp.cpp matrix.cpp minkowskidual.cpp minkowskisum.cpp minors.cpp mixedvolume.cpp monomial.cpp multiplicity.cpp myassert.cpp nbody.cpp newtonpolytope.cpp packedmonomial.cpp padic.cpp parser.cpp polyhedralcone.cpp \
+polyhedralfan.cpp polymakefile.cpp polynomialgcd.cpp polynomial.cpp polynomialring.cpp primarydecomposition.cpp printer.cpp regularsubdivision.cpp renderer.cpp restrictedautoreduction.cpp reversesearch.cpp saturation.cpp scarf.cpp subspace.cpp substitute.cpp symmetriccomplex.cpp \
+symmetrictraversal.cpp symmetry.cpp term.cpp termorder.cpp timer.cpp traverser_bsptree.cpp traverser_groebnerfan.cpp traverser_resultantfan.cpp traverser_resultantfanspecialization.cpp traverser_secondaryfan.cpp traverser_sphere.cpp traverser_stableintersection.cpp \
+traverser_tropical.cpp triangulation.cpp tropical2.cpp tropicalbasis.cpp tropicalcurve.cpp tropicaldeterminant.cpp tropicalmap.cpp tropical.cpp tropicaltraverse.cpp tropical_weildivisor.cpp vektor.cpp wallideal.cpp xfig.cpp
+gfan_LDADD = -lpthread -lgmp -lcddgmp

85
gfan-odr.patch Normal file
View File

@ -0,0 +1,85 @@
From a75e670e0e228e0a738eb65c7128a01446b4135c Mon Sep 17 00:00:00 2001
From: Alois Wohlschlager <alois1@gmx-topmail.de>
Date: Sat, 3 Jul 2021 11:07:23 +0200
Subject: [PATCH] Fix ODR violations
Upstream: not reachable
Various traversal code reused class names (Boundary, pathStepRidge,
pathStepFacet) in violation of the one definition rule. Put the
respective classes into anonymous namespaces to comply with ODR.
---
src/gfanlib_traversal.cpp | 4 ++++
src/symmetrictraversal.cpp | 4 ++++
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)
in the computation is made these edges will be deleted.
*/
+namespace
+{
class Boundary
{
@@ -185,6 +187,8 @@ struct pathStepFacet
list<ZVector> 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/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.
*/
+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
@@ -104,6 +104,9 @@ public:
}
};
+namespace
+{
+
/**
Rewrite these comments.
@@ -130,6 +133,8 @@ struct pathStepFacet
IntegerVectorList ridges;
};
+}
+
/**
We need to simulate two mutually recursive functions. An actual
implementation of these two functions would propably not work since
--
2.32.0

92
gfan-warnings.diff Normal file
View File

@ -0,0 +1,92 @@
[ 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;

64
gfan.changes Normal file
View File

@ -0,0 +1,64 @@
-------------------------------------------------------------------
Tue Jul 13 09:09:06 UTC 2021 - Alois Wohlschlager <alois1@gmx-topmail.de>
- Add gfan-odr.patch: A patch to fix ODR violations, which were
causing segfaults in the respective programs with LTO enabled.
-------------------------------------------------------------------
Sat Sep 19 10:05:47 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
- Add cddlib.patch
-------------------------------------------------------------------
Sat Aug 24 16:14:41 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Specfile modernization.
-------------------------------------------------------------------
Mon Dec 25 21:21:45 UTC 2017 - jengelh@inai.de
- Update to new upstream release 0.6.2
* Improved mixed volume computation, improved Gröbner basis
implementation.
* New tropical starting cone algorithm, resultant fan
algorithms, tropical hypersurface reconstruction algorithm,
tropical basis detection (in _tropicalintersection -t was
replaced by --tropicalbasistest)
* Stable intersection of tropical cycles (_fancommonrefinement
--stable)
* Better implementation of the field of rational functions).
- Delete gfan-format.diff, gfan-returns.diff,
gfan-remove-debug-code.diff (fixed upstream)
- Add gfan-warnings.diff
-------------------------------------------------------------------
Thu Jun 16 21:38:19 UTC 2016 - jengelh@inai.de
- Add missing post and postun sections for ldconfig
- Build with std=gnu++98 because the code has not been written
with C++11's std::rank in mind.
-------------------------------------------------------------------
Sat Oct 11 20:03:42 UTC 2014 - jengelh@inai.de
- Use source URLs
-------------------------------------------------------------------
Thu Sep 12 08:45:36 UTC 2013 - werner@suse.de
- Make it build with latest TeXLive 2013
-------------------------------------------------------------------
Thu Dec 6 10:02:08 UTC 2012 - jengelh@inai.de
- Add symlinks that are expected by other programs
-------------------------------------------------------------------
Wed Dec 5 13:23:19 UTC 2012 - jengelh@inai.de
- Throw out undocumented patches, throw out %makeinstall
-------------------------------------------------------------------
Tue Sep 27 01:02:28 UTC 2011 - jengelh@medozas.de
- Initial package (version 0.5) for build.opensuse.org

83
gfan.spec Normal file
View File

@ -0,0 +1,83 @@
#
# spec file for package gfan
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: gfan
Version: 0.6.2
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
Patch1: gfan-automake.diff
Patch2: gfan-warnings.diff
Patch3: cddlib.patch
Patch4: gfan-odr.patch
BuildRequires: automake
BuildRequires: cddlib-devel
BuildRequires: gcc-c++
BuildRequires: gmp-devel
%define with_pdf 1
%if 0%{?with_pdf}
BuildRequires: texlive-latex
%if 0%{?suse_version} >= 1230
BuildRequires: texlive-amsfonts
BuildRequires: texlive-bibtex
BuildRequires: texlive-cm-super
BuildRequires: texlive-dvips
BuildRequires: texlive-ntgclass
BuildRequires: texlive-ulem
%if 0%{?suse_version} > 1230
BuildRequires: tex(english.ldf)
%endif
%endif
%endif
%description
Gfan is a software package for computing Gröbner fans and tropical
varieties. These are polyhedral fans associated to polynomial ideals.
%prep
%autosetup -p1 -n %name%version
%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
%if 0%{?with_pdf}
make -C doc %{?_smp_mflags}
%endif
%install
b="%buildroot"
%make_install
for i in $(src/gfan _list | grep ^gfan_); do
ln -s gfan "$b/%_bindir/$i"
done
%files
%_bindir/gfan*
%license COPYING
%doc examples
%if 0%{?with_pdf}
%doc doc/manual.pdf
%endif
%changelog

BIN
gfan0.6.2.tar.gz Normal file

Binary file not shown.