source: git/Singular/dyn_modules/gfanlib/groebnerCone.h @ 296b78

fieker-DuValspielwiese
Last change on this file since 296b78 was 3f58b8d, checked in by Oleksandr Motsak <motsak@…>, 9 years ago
Removed libpolys from include path
  • Property mode set to 100644
File size: 3.8 KB
Line 
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
23class groebnerCone;
24struct groebnerCone_compare;
25typedef std::set<groebnerCone,groebnerCone_compare> groebnerCones;
26
27
28class groebnerCone
29{
30
31private:
32  /**
33   * ideal to which this Groebner cone belongs to
34   */
35  ideal polynomialIdeal;
36  /**
37   * ring in which the ideal exists
38   */
39  ring polynomialRing;
40  gfan::ZCone polyhedralCone;
41  gfan::ZVector interiorPoint;
42  const tropicalStrategy* currentStrategy;
43
44public:
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
54  void deletePolynomialData()
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; };
67  const tropicalStrategy* getTropicalStrategy() const { return currentStrategy; };
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   */
90  groebnerCones groebnerNeighbours() const;
91
92  /**
93   * Returns a complete list of neighboring Groebner cones in the tropical variety.
94   */
95  groebnerCones tropicalNeighbours() const;
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
106struct groebnerCone_compare
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
117gfan::ZFan* toFanStar(groebnerCones setOfCones);
118
119#ifndef NDEBUG
120BOOLEAN flipConeDebug(leftv res, leftv args);
121BOOLEAN groebnerNeighboursDebug(leftv res, leftv args);
122BOOLEAN tropicalNeighboursDebug(leftv res, leftv args);
123#endif
124
125#endif
Note: See TracBrowser for help on using the repository browser.