11 #include <gfanlib/gfanlib.h> 12 #include <gfanlib/gfanlib_matrix.h> 29 return ((!I) || (I && r));
37 int n =
rVar(r);
int*
w = r->wvhdl[0];
40 v = gfan::Integer((
long)-1)*
v;
43 std::cout <<
"ERROR: weight of ordering not inside Groebner cone!" << std::endl
44 <<
"cone: " << std::endl
46 <<
"weight: " << std::endl
52 return (zc.dimension()==0);
57 return zc.containsRelatively(p);
61 static bool checkOrderingAndWeight(
const ideal I,
const ring
r,
const gfan::ZVector
w,
const tropicalStrategy& currentCase)
65 return zc.contains(
w);
74 std::cout <<
"ERROR: interiorPoint is not contained in the Groebner cone!" << std::endl
75 <<
"cone: " << std::endl
77 <<
"interiorPoint:" << std::endl
78 << interiorPoint << std::endl;
83 std::cout <<
"ERROR: interiorPoint is contained in the interior of the maximal Groebner cone!" << std::endl
84 <<
"cone: " << std::endl
86 <<
"interiorPoint:" << std::endl
87 << interiorPoint << std::endl;
90 gfan::ZCone hopefullyAFacet =
polyhedralCone.faceContaining(interiorPoint);
93 std::cout <<
"ERROR: interiorPoint is not contained in the interior of a facet!" << std::endl
94 <<
"cone: " << std::endl
96 <<
"interiorPoint:" << std::endl
97 << interiorPoint << std::endl;
102 if(dual.containsRelatively(facetNormal))
104 std::cout <<
"ERROR: facetNormal is not pointing outwards!" << std::endl
105 <<
"cone: " << std::endl
107 <<
"facetNormal:" << std::endl
108 << facetNormal << std::endl;
140 int* leadexpv = (
int*)
omAlloc((n+1)*
sizeof(int));
141 int* tailexpv = (
int*)
omAlloc((n+1)*
sizeof(int));
142 gfan::ZVector leadexpw = gfan::ZVector(n);
143 gfan::ZVector tailexpw = gfan::ZVector(n);
157 inequalities.appendRow(leadexpw-tailexpw);
171 polyhedralCone = gfan::ZCone(inequalities,gfan::ZMatrix(0, inequalities.getWidth()));
193 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
194 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
208 equations.appendRow(leadexpv-tailexpv);
212 inequalities.appendRow(leadexpv-tailexpv);
251 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
252 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
267 equations.appendRow(leadexpv-tailexpv);
271 inequalities.appendRow(leadexpv-tailexpv);
303 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
304 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
316 equations.appendRow(leadexpv-tailexpv);
332 inequalities.appendRow(leadexpv-tailexpv);
339 gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
340 lowerHalfSpaceCondition[0] = -1;
341 inequalities.appendRow(lowerHalfSpaceCondition);
406 gfan::ZMatrix
R = coneToCheck.extremeRays();
407 for (
int i=0;
i<R.getHeight();
i++)
421 return gfan::ZVector();
439 id_Delete(&flipped.first,flipped.second);
452 gfan::ZMatrix interiorPoints = facetsData.first;
453 gfan::ZMatrix facetNormals = facetsData.second;
456 for (
int i=0;
i<interiorPoints.getHeight();
i++)
458 gfan::ZVector
w = interiorPoints[
i];
459 gfan::ZVector
v = facetNormals[
i];
463 if (w[0].
sign()==0 && v[0].
sign()>0)
466 neighbours.insert(
flipCone(interiorPoints[
i],facetNormals[i]));
475 return (!dual.contains(w));
486 for (
int i=0;
i<interiorPoints.getHeight();
i++)
492 for (
int j=0;
j<ray.getHeight();
j++)
496 neighbours.insert(neighbour);
507 if (setOfCones.size() > 0)
509 groebnerCones::iterator sigma = setOfCones.begin();
510 gfan::ZFan* zf =
new gfan::ZFan(sigma->getPolyhedralCone().ambientDimension());
511 for (; sigma!=setOfCones.end(); sigma++)
513 gfan::ZCone zc = sigma->getPolyhedralCone();
520 return new gfan::ZFan(gfan::ZFan(
currRing->N));
543 ideal I = (ideal) u->
CopyD();
544 number
p = (number) v->
CopyD();
557 delete interiorPoint0;
569 WerrorS(
"computeFlipDebug: unexpected parameters");
584 ideal I = (ideal) u->
CopyD();
585 number
p = (number) v->
CopyD();
598 WerrorS(
"computeFlipDebug: unexpected parameters");
613 ideal I = (ideal) u->
CopyD();
614 number
p = (number) v->
CopyD();
627 WerrorS(
"computeFlipDebug: unexpected parameters");
implementation of the class tropicalStrategy
const CanonicalForm int s
BOOLEAN flipConeDebug(leftv res, leftv args)
gfan::ZCone getPolyhedralCone() const
const tropicalStrategy * currentStrategy
Class used for (list of) interpreter objects.
ring getPolynomialRing() const
gfan::ZCone polyhedralCone
bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
Debug tools.
groebnerCones tropicalNeighbours() const
Returns a complete list of neighboring Groebner cones in the tropical variety.
ideal id_Copy(ideal h1, const ring r)
copy an ideal
long wDeg(const poly p, const ring r, const gfan::ZVector w)
various functions to compute the initial form of polynomials and ideals
static void p_GetExpV(poly p, int *ev, const ring r)
#define omFreeSize(addr, size)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
gfan::ZVector wvhdlEntryToZVector(const int n, const int *wvhdl0)
BOOLEAN groebnerNeighboursDebug(leftv res, leftv args)
static bool checkPolynomialInput(const ideal I, const ring r)
void WerrorS(const char *s)
static tropicalStrategy debugStrategy(const ideal startIdeal, number unifParameter, ring startRing)
std::pair< gfan::ZMatrix, gfan::ZMatrix > interiorPointsAndNormalsOfFacets(const gfan::ZCone zc, const std::set< gfan::ZVector > &exceptThesePoints, const bool onlyLowerHalfSpace)
static bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)
gfan::ZVector tropicalPoint() const
Returns a point in the tropical variety, if the groebnerCone contains one.
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 ...
std::set< groebnerCone, groebnerCone_compare > groebnerCones
const tropicalStrategy * getTropicalStrategy() const
poly initial(const poly p, const ring r, const gfan::ZVector w)
Returns the initial form of p with respect to w.
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
ideal polynomialIdeal
ideal to which this Groebner cone belongs to
gfan::ZFan * toFanStar(groebnerCones setOfCones)
BOOLEAN inequalities(leftv res, leftv args)
gfan::ZVector intStar2ZVector(const int d, const int *i)
ring polynomialRing
ring in which the ideal exists
void pReduce(ideal I, const ring r) const
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
gfan::ZVector expvToZVector(const int n, const int *expv)
bool contains(const gfan::ZVector &w) const
Returns true if Groebner cone contains w, false otherwise.
static void p_Delete(poly *p, const ring r)
bool pointsOutwards(const gfan::ZVector) const
BOOLEAN tropicalNeighboursDebug(leftv res, leftv args)
const Variable & v
< [in] a sqrfree bivariate poly
gfan::ZVector interiorPoint
static bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)
bool reduce(ideal I, const ring r) const
reduces the generators of an ideal I so that the inequalities and equations of the Groebner cone can ...
implementation of the class groebnerCone
void rDelete(ring r)
unconditionally deletes fields in r
gfan::ZVector getInteriorPoint() const
BOOLEAN equations(leftv res, leftv args)
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...
std::string toString(const gfan::ZCone *const c)
groebnerCone & operator=(const groebnerCone &sigma)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
gfan::ZMatrix raysOfTropicalStar(ideal I, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
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...
gfan::ZMatrix interiorPointsOfFacets(const gfan::ZCone &zc, const std::set< gfan::ZVector > &exceptThese)
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
ideal getPolynomialIdeal() const