groebnerCone.h
Go to the documentation of this file.
1 #ifndef CALLGFANLIB_GROEBNERCONE_H
2 #define CALLGFANLIB_GROEBNERCONE_H
3 
4 #include <kernel/polys.h>
5 #include <Singular/ipid.h>
6 
7 #include <polys/monomials/ring.h>
8 #include <polys/simpleideals.h>
9 #include <kernel/ideals.h>
10 #include <gfanlib/gfanlib.h>
11 #include <set>
12 
13 #include <tropicalStrategy.h>
14 
15 /** \file
16  * implementation of the class groebnerCone
17  *
18  * groebnerCone is a class that encapsulates relevant (possibly redundant) information about a groebnerCone.
19  * Moreover, it contains implrementation of several highly non-trivial algorithms, such as computing its neighbours
20  * in the Groebner fan or computing its neighbours in the tropical variety.
21  */
22 
23 class groebnerCone;
25 typedef std::set<groebnerCone,groebnerCone_compare> groebnerCones;
26 
27 
29 {
30 
31 private:
32  /**
33  * ideal to which this Groebner cone belongs to
34  */
36  /**
37  * ring in which the ideal exists
38  */
40  gfan::ZCone polyhedralCone;
41  gfan::ZVector interiorPoint;
43 
44 public:
45  groebnerCone();
46  groebnerCone(const ideal I, const ring r, const tropicalStrategy& currentCase);
47  groebnerCone(const ideal I, const ring r, const gfan::ZVector& w, const tropicalStrategy& currentCase);
48  groebnerCone(const ideal I, const ring r, const gfan::ZVector& u, const gfan::ZVector& w, const tropicalStrategy& currentCase);
49  groebnerCone(const ideal I, const ideal inI, const ring r, const tropicalStrategy& currentCase);
50  groebnerCone(const groebnerCone& sigma);
51  ~groebnerCone();
52  groebnerCone& operator=(const groebnerCone& sigma);
53 
55  {
56  assume ((!polynomialIdeal) || (polynomialIdeal && polynomialRing));
57  if (polynomialIdeal) id_Delete(&polynomialIdeal,polynomialRing);
58  if (polynomialRing) rDelete(polynomialRing);
59  polynomialIdeal = NULL;
60  polynomialRing = NULL;
61  }
62 
64  ring getPolynomialRing() const { return polynomialRing; };
65  gfan::ZCone getPolyhedralCone() const { return polyhedralCone; };
66  gfan::ZVector getInteriorPoint() const { return interiorPoint; };
68  friend struct groebnerCone_compare;
69 
70  /**
71  * Returns true if Groebner cone contains w, false otherwise
72  */
73  bool contains(const gfan::ZVector &w) const;
74 
75  /**
76  * Returns a point in the tropical variety, if the groebnerCone contains one.
77  * Returns an empty vector otherwise.
78  */
79  gfan::ZVector tropicalPoint() const;
80 
81  /**
82  * Given an interior point on the facet and the outer normal factor on the facet,
83  * returns the adjacent groebnerCone sharing that facet
84  */
85  groebnerCone flipCone(const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const;
86 
87  /**
88  * Returns a complete list of neighboring Groebner cones.
89  */
91 
92  /**
93  * Returns a complete list of neighboring Groebner cones in the tropical variety.
94  */
96 
97  /**
98  * Debug tools.
99  */
100  #ifndef NDEBUG
101  bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;
102  bool pointsOutwards(const gfan::ZVector) const;
103  #endif
104 };
105 
107 {
108  bool operator()(const groebnerCone &sigma, const groebnerCone &theta) const
109  {
110  const gfan::ZVector p1 = sigma.getInteriorPoint();
111  const gfan::ZVector p2 = theta.getInteriorPoint();
112  assume (p1.size() == p2.size());
113  return p1 < p2;
114  }
115 };
116 
117 gfan::ZFan* toFanStar(groebnerCones setOfCones);
118 
119 #ifndef NDEBUG
123 #endif
124 
125 #endif
implementation of the class tropicalStrategy
gfan::ZVector getInteriorPoint() const
Definition: groebnerCone.h:66
const tropicalStrategy * currentStrategy
Definition: groebnerCone.h:42
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const tropicalStrategy * getTropicalStrategy() const
Definition: groebnerCone.h:67
groebnerCone flipCone(const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const
Given an interior point on the facet and the outer normal factor on the facet, returns the adjacent g...
BOOLEAN flipConeDebug(leftv res, leftv args)
gfan::ZCone polyhedralCone
Definition: groebnerCone.h:40
Compatiblity layer for legacy polynomial operations (over currRing)
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:65
groebnerCones tropicalNeighbours() const
Returns a complete list of neighboring Groebner cones in the tropical variety.
BOOLEAN tropicalNeighboursDebug(leftv res, leftv args)
bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
Debug tools.
Definition: groebnerCone.cc:69
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:24
void deletePolynomialData()
Definition: groebnerCone.h:54
poly res
Definition: myNF.cc:322
ideal polynomialIdeal
ideal to which this Groebner cone belongs to
Definition: groebnerCone.h:35
const ring r
Definition: syzextra.cc:208
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
#define assume(x)
Definition: mod2.h:405
ideal getPolynomialIdeal() const
Definition: groebnerCone.h:63
ring polynomialRing
ring in which the ideal exists
Definition: groebnerCone.h:39
bool pointsOutwards(const gfan::ZVector) const
BOOLEAN groebnerNeighboursDebug(leftv res, leftv args)
gfan::ZVector interiorPoint
Definition: groebnerCone.h:41
bool operator()(const groebnerCone &sigma, const groebnerCone &theta) const
Definition: groebnerCone.h:108
#define NULL
Definition: omList.c:10
bool contains(const gfan::ZVector &w) const
Returns true if Groebner cone contains w, false otherwise.
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
ring getPolynomialRing() const
Definition: groebnerCone.h:64
const CanonicalForm & w
Definition: facAbsFact.cc:55
gfan::ZFan * toFanStar(groebnerCones setOfCones)
groebnerCone & operator=(const groebnerCone &sigma)
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
int BOOLEAN
Definition: auxiliary.h:131
gfan::ZVector tropicalPoint() const
Returns a point in the tropical variety, if the groebnerCone contains one.