My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends
groebnerCone Class Reference

#include <groebnerCone.h>

Public Member Functions

 groebnerCone ()
 
 groebnerCone (const ideal I, const ring r, const tropicalStrategy &currentCase)
 
 groebnerCone (const ideal I, const ring r, const gfan::ZVector &w, const tropicalStrategy &currentCase)
 
 groebnerCone (const ideal I, const ring r, const gfan::ZVector &u, const gfan::ZVector &w, const tropicalStrategy &currentCase)
 
 groebnerCone (const ideal I, const ideal inI, const ring r, const tropicalStrategy &currentCase)
 
 groebnerCone (const groebnerCone &sigma)
 
 ~groebnerCone ()
 
groebnerConeoperator= (const groebnerCone &sigma)
 
void deletePolynomialData ()
 
ideal getPolynomialIdeal () const
 
ring getPolynomialRing () const
 
gfan::ZCone getPolyhedralCone () const
 
gfan::ZVector getInteriorPoint () const
 
const tropicalStrategygetTropicalStrategy () const
 
bool isTrivial () const
 
bool contains (const gfan::ZVector &w) const
 Returns true if Groebner cone contains w, false otherwise.
 
gfan::ZVector tropicalPoint () const
 Returns a point in the tropical variety, if the groebnerCone contains one.
 
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 groebnerCone sharing that facet.
 
groebnerCones groebnerNeighbours () const
 Returns a complete list of neighboring Groebner cones.
 
groebnerCones tropicalNeighbours () const
 Returns a complete list of neighboring Groebner cones in the tropical variety.
 
bool pointsOutwards (const gfan::ZVector w) const
 Return 1 if w points is in the dual of the polyhedral cone, 0 otherwise.
 
bool checkFlipConeInput (const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
 Debug tools.
 

Private Attributes

ideal polynomialIdeal
 ideal to which this Groebner cone belongs to
 
ring polynomialRing
 ring in which the ideal exists
 
gfan::ZCone polyhedralCone
 
gfan::ZVector interiorPoint
 
const tropicalStrategycurrentStrategy
 

Friends

struct groebnerCone_compare
 

Detailed Description

Definition at line 27 of file groebnerCone.h.

Constructor & Destructor Documentation

◆ groebnerCone() [1/6]

groebnerCone::groebnerCone ( )

Definition at line 69 of file groebnerCone.cc.

69 :
75{
76}
const tropicalStrategy * currentStrategy
gfan::ZVector interiorPoint
ideal polynomialIdeal
ideal to which this Groebner cone belongs to
gfan::ZCone polyhedralCone
ring polynomialRing
ring in which the ideal exists
#define NULL
Definition omList.c:12

◆ groebnerCone() [2/6]

groebnerCone::groebnerCone ( const ideal  I,
const ring  r,
const tropicalStrategy currentCase 
)

Definition at line 78 of file groebnerCone.cc.

78 :
82{
84 if (r) polynomialRing = rCopy(r);
85 if (I)
86 {
90 }
91
92 int n = rVar(polynomialRing);
93 poly g = NULL;
94 int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
95 int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
99 for (int i=0; i<IDELEMS(polynomialIdeal); i++)
100 {
101 g = polynomialIdeal->m[i];
102 if (g)
103 {
106 pIter(g);
107 while (g)
108 {
111 inequalities.appendRow(leadexpw-tailexpw);
112 pIter(g);
113 }
114 }
115 }
116 omFreeSize(leadexpv,(n+1)*sizeof(int));
117 omFreeSize(tailexpv,(n+1)*sizeof(int));
118 // if (currentStrategy->restrictToLowerHalfSpace())
119 // {
120 // gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
121 // lowerHalfSpaceCondition[0] = -1;
122 // inequalities.appendRow(lowerHalfSpaceCondition);
123 // }
124
126 polyhedralCone.canonicalize();
127 interiorPoint = polyhedralCone.getRelativeInteriorPoint();
129}
BOOLEAN inequalities(leftv res, leftv args)
Definition bbcone.cc:560
gfan::ZVector expvToZVector(const int n, const int *expv)
int i
Definition cfEzgcd.cc:132
g
Definition cfModGcd.cc:4098
ideal id_Copy(ideal h1, const ring r)
copy an ideal
#define assume(x)
Definition mod2.h:389
#define pIter(p)
Definition monomials.h:37
#define omFreeSize(addr, size)
#define omAlloc(size)
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1536
ring rCopy(ring r)
Definition ring.cc:1736
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
#define IDELEMS(i)
bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)
bool checkPolynomialInput(const ideal I, const ring r)

◆ groebnerCone() [3/6]

groebnerCone::groebnerCone ( const ideal  I,
const ring  r,
const gfan::ZVector w,
const tropicalStrategy currentCase 
)

Definition at line 131 of file groebnerCone.cc.

131 :
135{
137 if (r) polynomialRing = rCopy(r);
138 if (I)
139 {
143 }
144
145 int n = rVar(polynomialRing);
148 int* expv = (int*) omAlloc((n+1)*sizeof(int));
149 for (int i=0; i<IDELEMS(polynomialIdeal); i++)
150 {
151 poly g = polynomialIdeal->m[i];
152 if (g)
153 {
156 long d = wDeg(g,polynomialRing,w);
157 for (pIter(g); g; pIter(g))
158 {
161 if (wDeg(g,polynomialRing,w)==d)
162 equations.appendRow(leadexpv-tailexpv);
163 else
164 {
166 inequalities.appendRow(leadexpv-tailexpv);
167 }
168 }
169 }
170 }
171 omFreeSize(expv,(n+1)*sizeof(int));
172 // if (currentStrategy->restrictToLowerHalfSpace())
173 // {
174 // gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
175 // lowerHalfSpaceCondition[0] = -1;
176 // inequalities.appendRow(lowerHalfSpaceCondition);
177 // }
178
180 polyhedralCone.canonicalize();
181 interiorPoint = polyhedralCone.getRelativeInteriorPoint();
183}
BOOLEAN equations(leftv res, leftv args)
Definition bbcone.cc:577
gfan::ZVector intStar2ZVector(const int d, const int *i)
const CanonicalForm & w
Definition facAbsFact.cc:51
long wDeg(const poly p, const ring r, const gfan::ZVector &w)
various functions to compute the initial form of polynomials and ideals
Definition initial.cc:6

◆ groebnerCone() [4/6]

groebnerCone::groebnerCone ( const ideal  I,
const ring  r,
const gfan::ZVector u,
const gfan::ZVector w,
const tropicalStrategy currentCase 
)

Definition at line 189 of file groebnerCone.cc.

189 :
193{
196 if (r) polynomialRing = rCopy(r);
197 if (I)
198 {
202 }
203
204 int n = rVar(polynomialRing);
207 int* expv = (int*) omAlloc((n+1)*sizeof(int));
208 for (int i=0; i<IDELEMS(polynomialIdeal); i++)
209 {
210 poly g = polynomialIdeal->m[i];
211 if (g)
212 {
215 long d1 = wDeg(g,polynomialRing,u);
216 long d2 = wDeg(g,polynomialRing,w);
217 for (pIter(g); g; pIter(g))
218 {
222 equations.appendRow(leadexpv-tailexpv);
223 else
224 {
226 inequalities.appendRow(leadexpv-tailexpv);
227 }
228 }
229 }
230 }
231 omFreeSize(expv,(n+1)*sizeof(int));
232 // if (currentStrategy->restrictToLowerHalfSpace())
233 // {
234 // gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
235 // lowerHalfSpaceCondition[0] = -1;
236 // inequalities.appendRow(lowerHalfSpaceCondition);
237 // }
238
240 polyhedralCone.canonicalize();
241 interiorPoint = polyhedralCone.getRelativeInteriorPoint();
243}
bool checkWeightVector(const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder)

◆ groebnerCone() [5/6]

groebnerCone::groebnerCone ( const ideal  I,
const ideal  inI,
const ring  r,
const tropicalStrategy currentCase 
)

Definition at line 246 of file groebnerCone.cc.

246 :
250{
253
256
257 int n = rVar(r);
259 int* expv = (int*) omAlloc((n+1)*sizeof(int));
260 for (int i=0; i<IDELEMS(inI); i++)
261 {
262 poly g = inI->m[i];
263 if (g)
264 {
265 p_GetExpV(g,expv,r);
267 for (pIter(g); g; pIter(g))
268 {
269 p_GetExpV(g,expv,r);
271 equations.appendRow(leadexpv-tailexpv);
272 }
273 }
274 }
276 for (int i=0; i<IDELEMS(polynomialIdeal); i++)
277 {
278 poly g = polynomialIdeal->m[i];
279 if (g)
280 {
281 p_GetExpV(g,expv,r);
283 for (pIter(g); g; pIter(g))
284 {
285 p_GetExpV(g,expv,r);
287 inequalities.appendRow(leadexpv-tailexpv);
288 }
289 }
290 }
291 omFreeSize(expv,(n+1)*sizeof(int));
293 {
297 }
298
300 polyhedralCone.canonicalize();
301 interiorPoint = polyhedralCone.getRelativeInteriorPoint();
303}
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise

◆ groebnerCone() [6/6]

groebnerCone::groebnerCone ( const groebnerCone sigma)

Definition at line 305 of file groebnerCone.cc.

305 :
308 polyhedralCone(gfan::ZCone(sigma.getPolyhedralCone())),
309 interiorPoint(gfan::ZVector(sigma.getInteriorPoint())),
310 currentStrategy(sigma.getTropicalStrategy())
311{
312 assume(checkPolynomialInput(sigma.getPolynomialIdeal(),sigma.getPolynomialRing()));
313 assume(checkOrderingAndCone(sigma.getPolynomialRing(),sigma.getPolyhedralCone()));
314 assume(checkPolyhedralInput(sigma.getPolyhedralCone(),sigma.getInteriorPoint()));
315 if (sigma.getPolynomialIdeal()) polynomialIdeal = id_Copy(sigma.getPolynomialIdeal(),sigma.getPolynomialRing());
316 if (sigma.getPolynomialRing()) polynomialRing = rCopy(sigma.getPolynomialRing());
317}
bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)

◆ ~groebnerCone()

groebnerCone::~groebnerCone ( )

Definition at line 319 of file groebnerCone.cc.

320{
326}
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix

Member Function Documentation

◆ checkFlipConeInput()

bool groebnerCone::checkFlipConeInput ( const gfan::ZVector  interiorPoint,
const gfan::ZVector  facetNormal 
) const

Debug tools.

Definition at line 23 of file groebnerCone.cc.

24{
25 /* check first whether interiorPoint lies on the boundary of the cone */
26 if (!polyhedralCone.contains(interiorPoint))
27 {
28 std::cout << "ERROR: interiorPoint is not contained in the Groebner cone!" << std::endl
29 << "cone: " << std::endl
31 << "interiorPoint:" << std::endl
32 << interiorPoint << std::endl;
33 return false;
34 }
35 if (polyhedralCone.containsRelatively(interiorPoint))
36 {
37 std::cout << "ERROR: interiorPoint is contained in the interior of the maximal Groebner cone!" << std::endl
38 << "cone: " << std::endl
40 << "interiorPoint:" << std::endl
41 << interiorPoint << std::endl;
42 return false;
43 }
45 if (hopefullyAFacet.dimension()!=(polyhedralCone.dimension()-1))
46 {
47 std::cout << "ERROR: interiorPoint is not contained in the interior of a facet!" << std::endl
48 << "cone: " << std::endl
50 << "interiorPoint:" << std::endl
51 << interiorPoint << std::endl;
52 return false;
53 }
54 /* check whether facet normal points outwards */
55 gfan::ZCone dual = polyhedralCone.dualCone();
56 if(dual.containsRelatively(facetNormal))
57 {
58 std::cout << "ERROR: facetNormal is not pointing outwards!" << std::endl
59 << "cone: " << std::endl
61 << "facetNormal:" << std::endl
62 << facetNormal << std::endl;
63 return false;
64 }
65 return true;
66}
std::string toString(const gfan::ZCone *const c)
Definition bbcone.cc:27

◆ contains()

bool groebnerCone::contains ( const gfan::ZVector w) const

Returns true if Groebner cone contains w, false otherwise.

Definition at line 344 of file groebnerCone.cc.

345{
346 return polyhedralCone.contains(w);
347}

◆ deletePolynomialData()

void groebnerCone::deletePolynomialData ( )
inline

◆ flipCone()

groebnerCone 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 groebnerCone sharing that facet.

Definition at line 383 of file groebnerCone.cc.

384{
385 assume(this->checkFlipConeInput(interiorPoint,facetNormal));
387 /* Note: the polynomial ring created will have a weighted ordering with respect to interiorPoint
388 * and with a weighted ordering with respect to facetNormal as tiebreaker.
389 * Hence it is sufficient to compute the initial form with respect to facetNormal,
390 * to obtain an initial form with respect to interiorPoint+e*facetNormal,
391 * for e>0 sufficiently small */
396 rDelete(flipped.second);
397 return flippedCone;
398}
ListItem< T > * first
Definition ftmpl_list.h:54
bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
Debug tools.
std::pair< ideal, ring > computeFlip(const ideal Ir, const ring r, const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const
given an interior point of a groebner cone computes the groebner cone adjacent to it

◆ getInteriorPoint()

gfan::ZVector groebnerCone::getInteriorPoint ( ) const
inline

Definition at line 65 of file groebnerCone.h.

65{ return interiorPoint; };

◆ getPolyhedralCone()

gfan::ZCone groebnerCone::getPolyhedralCone ( ) const
inline

Definition at line 64 of file groebnerCone.h.

64{ return polyhedralCone; };

◆ getPolynomialIdeal()

ideal groebnerCone::getPolynomialIdeal ( ) const
inline

Definition at line 62 of file groebnerCone.h.

62{ return polynomialIdeal; };

◆ getPolynomialRing()

ring groebnerCone::getPolynomialRing ( ) const
inline

Definition at line 63 of file groebnerCone.h.

63{ return polynomialRing; };

◆ getTropicalStrategy()

const tropicalStrategy * groebnerCone::getTropicalStrategy ( ) const
inline

Definition at line 66 of file groebnerCone.h.

66{ return currentStrategy; };

◆ groebnerNeighbours()

groebnerCones groebnerCone::groebnerNeighbours ( ) const

Returns a complete list of neighboring Groebner cones.

Definition at line 404 of file groebnerCone.cc.

405{
406 std::pair<gfan::ZMatrix, gfan::ZMatrix> facetsData = interiorPointsAndNormalsOfFacets(polyhedralCone);
407
410
412 for (int i=0; i<interiorPoints.getHeight(); i++)
413 {
417 {
418 assume(w[0].sign()<=0);
419 if (w[0].sign()==0 && v[0].sign()>0)
420 continue;
421 }
423 }
424 return neighbours;
425}
std::pair< gfan::ZMatrix, gfan::ZMatrix > interiorPointsAndNormalsOfFacets(const gfan::ZCone zc, const std::set< gfan::ZVector > &exceptThesePoints, const bool onlyLowerHalfSpace)
Definition bbcone.cc:1853
void insert(const T &)
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...
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
std::set< groebnerCone, groebnerCone_compare > groebnerCones
static int sign(int x)
Definition ring.cc:3497

◆ isTrivial()

bool groebnerCone::isTrivial ( ) const
inline

Definition at line 69 of file groebnerCone.h.

70 {
71 bool b = (polynomialRing==NULL);
72 return b;
73 }
CanonicalForm b
Definition cfModGcd.cc:4111

◆ operator=()

groebnerCone & groebnerCone::operator= ( const groebnerCone sigma)

Definition at line 328 of file groebnerCone.cc.

329{
330 assume(checkPolynomialInput(sigma.getPolynomialIdeal(),sigma.getPolynomialRing()));
331 assume(checkOrderingAndCone(sigma.getPolynomialRing(),sigma.getPolyhedralCone()));
332 assume(checkPolyhedralInput(sigma.getPolyhedralCone(),sigma.getInteriorPoint()));
333 if (sigma.getPolynomialIdeal()) polynomialIdeal = id_Copy(sigma.getPolynomialIdeal(),sigma.getPolynomialRing());
334 if (sigma.getPolynomialRing()) polynomialRing = rCopy(sigma.getPolynomialRing());
335 polyhedralCone = sigma.getPolyhedralCone();
336 interiorPoint = sigma.getInteriorPoint();
337 currentStrategy = sigma.getTropicalStrategy();
338 return *this;
339}

◆ pointsOutwards()

bool groebnerCone::pointsOutwards ( const gfan::ZVector  w) const

Return 1 if w points is in the dual of the polyhedral cone, 0 otherwise.

Definition at line 428 of file groebnerCone.cc.

429{
430 gfan::ZCone dual = polyhedralCone.dualCone();
431 return (!dual.contains(w));
432}

◆ tropicalNeighbours()

groebnerCones groebnerCone::tropicalNeighbours ( ) const

Returns a complete list of neighboring Groebner cones in the tropical variety.

Definition at line 438 of file groebnerCone.cc.

439{
442 for (int i=0; i<interiorPoints.getHeight(); i++)
443 {
444 if (!(currentStrategy->restrictToLowerHalfSpace() && interiorPoints[i][0].sign()==0))
445 {
448 for (int j=0; j<ray.getHeight(); j++)
449 if (pointsOutwards(ray[j]))
450 {
453 }
455 }
456 }
457 return neighbours;
458}
gfan::ZMatrix interiorPointsOfFacets(const gfan::ZCone &zc, const std::set< gfan::ZVector > &exceptThese)
Definition bbcone.cc:1799
bool pointsOutwards(const gfan::ZVector w) const
Return 1 if w points is in the dual of the polyhedral cone, 0 otherwise.
int j
Definition facHensel.cc:110
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition initial.cc:30
gfan::ZMatrix raysOfTropicalStar(ideal I, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)

◆ tropicalPoint()

gfan::ZVector groebnerCone::tropicalPoint ( ) const

Returns a point in the tropical variety, if the groebnerCone contains one.

Returns an empty vector otherwise.

Definition at line 354 of file groebnerCone.cc.

355{
359
361 gfan::ZMatrix R = coneToCheck.extremeRays();
362 for (int i=0; i<R.getHeight(); i++)
363 {
364 assume(!currentStrategy->restrictToLowerHalfSpace() || R[i][0].sign()<=0);
365 if (currentStrategy->restrictToLowerHalfSpace() && R[i][0].sign()==0)
366 continue;
367 std::pair<poly,int> s = currentStrategy->checkInitialIdealForMonomial(I,r,R[i]);
368 if (s.first==NULL)
369 {
370 if (s.second<0)
371 // if monomial was initialized, delete it
372 p_Delete(&s.first,r);
373 return R[i];
374 }
375 }
376 return gfan::ZVector();
377}
std::pair< poly, int > checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector &w=0) const
If given w, assuming w is in the Groebner cone of the ordering on r and I is a standard basis with re...
const CanonicalForm int s
Definition facAbsFact.cc:51
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
#define R
Definition sirandom.c:27

Friends And Related Symbol Documentation

◆ groebnerCone_compare

Definition at line 67 of file groebnerCone.h.

Field Documentation

◆ currentStrategy

const tropicalStrategy* groebnerCone::currentStrategy
private

Definition at line 41 of file groebnerCone.h.

◆ interiorPoint

gfan::ZVector groebnerCone::interiorPoint
private

Definition at line 40 of file groebnerCone.h.

◆ polyhedralCone

gfan::ZCone groebnerCone::polyhedralCone
private

Definition at line 39 of file groebnerCone.h.

◆ polynomialIdeal

ideal groebnerCone::polynomialIdeal
private

ideal to which this Groebner cone belongs to

Definition at line 34 of file groebnerCone.h.

◆ polynomialRing

ring groebnerCone::polynomialRing
private

ring in which the ideal exists

Definition at line 38 of file groebnerCone.h.


The documentation for this class was generated from the following files: