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 
63  ideal getPolynomialIdeal() const { return polynomialIdeal; };
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  bool isTrivial() const
71  {
72  bool b = (polynomialRing==NULL);
73  return b;
74  }
75 
76  /**
77  * Returns true if Groebner cone contains w, false otherwise
78  */
79  bool contains(const gfan::ZVector &w) const;
80 
81  /**
82  * Returns a point in the tropical variety, if the groebnerCone contains one.
83  * Returns an empty vector otherwise.
84  */
85  gfan::ZVector tropicalPoint() const;
86 
87  /**
88  * Given an interior point on the facet and the outer normal factor on the facet,
89  * returns the adjacent groebnerCone sharing that facet
90  */
91  groebnerCone flipCone(const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const;
92 
93  /**
94  * Returns a complete list of neighboring Groebner cones.
95  */
97 
98  /**
99  * Returns a complete list of neighboring Groebner cones in the tropical variety.
100  */
102 
103  /**
104  * Debug tools.
105  */
106  #ifndef NDEBUG
107  bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const;
108  bool pointsOutwards(const gfan::ZVector) const;
109  #endif
110 };
111 
113 {
114  bool operator()(const groebnerCone &sigma, const groebnerCone &theta) const
115  {
116  const gfan::ZVector p1 = sigma.getInteriorPoint();
117  const gfan::ZVector p2 = theta.getInteriorPoint();
118  assume (p1.size() == p2.size());
119  return p1 < p2;
120  }
121 };
122 
123 gfan::ZFan* toFanStar(groebnerCones setOfCones);
124 
125 #ifndef NDEBUG
129 #endif
130 
131 #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)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
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)
bool isTrivial() const
Definition: groebnerCone.h:70
gfan::ZVector interiorPoint
Definition: groebnerCone.h:41
bool operator()(const groebnerCone &sigma, const groebnerCone &theta) const
Definition: groebnerCone.h:114
#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
const poly b
Definition: syzextra.cc:213
gfan::ZVector tropicalPoint() const
Returns a point in the tropical variety, if the groebnerCone contains one.