11 #include <gfanlib/gfanlib.h> 12 #include <gfanlib/gfanlib_matrix.h> 31 std::cout <<
"ERROR: interiorPoint is not contained in the Groebner cone!" << std::endl
32 <<
"cone: " << std::endl
34 <<
"interiorPoint:" << std::endl
35 << interiorPoint << std::endl;
40 std::cout <<
"ERROR: interiorPoint is contained in the interior of the maximal Groebner cone!" << std::endl
41 <<
"cone: " << std::endl
43 <<
"interiorPoint:" << std::endl
44 << interiorPoint << std::endl;
47 gfan::ZCone hopefullyAFacet =
polyhedralCone.faceContaining(interiorPoint);
50 std::cout <<
"ERROR: interiorPoint is not contained in the interior of a facet!" << std::endl
51 <<
"cone: " << std::endl
53 <<
"interiorPoint:" << std::endl
54 << interiorPoint << std::endl;
59 if(dual.containsRelatively(facetNormal))
61 std::cout <<
"ERROR: facetNormal is not pointing outwards!" << std::endl
62 <<
"cone: " << std::endl
64 <<
"facetNormal:" << std::endl
65 << facetNormal << std::endl;
97 int* leadexpv = (
int*)
omAlloc((n+1)*
sizeof(int));
98 int* tailexpv = (
int*)
omAlloc((n+1)*
sizeof(int));
99 gfan::ZVector leadexpw = gfan::ZVector(n);
100 gfan::ZVector tailexpw = gfan::ZVector(n);
114 inequalities.appendRow(leadexpw-tailexpw);
128 polyhedralCone = gfan::ZCone(inequalities,gfan::ZMatrix(0, inequalities.getWidth()));
150 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
151 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
165 equations.appendRow(leadexpv-tailexpv);
169 inequalities.appendRow(leadexpv-tailexpv);
209 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
210 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
225 equations.appendRow(leadexpv-tailexpv);
229 inequalities.appendRow(leadexpv-tailexpv);
261 gfan::ZMatrix
equations = gfan::ZMatrix(0,n);
262 int* expv = (
int*)
omAlloc((n+1)*
sizeof(int));
274 equations.appendRow(leadexpv-tailexpv);
290 inequalities.appendRow(leadexpv-tailexpv);
297 gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
298 lowerHalfSpaceCondition[0] = -1;
299 inequalities.appendRow(lowerHalfSpaceCondition);
364 gfan::ZMatrix
R = coneToCheck.extremeRays();
365 for (
int i=0;
i<R.getHeight();
i++)
379 return gfan::ZVector();
398 id_Delete(&flipped.first,flipped.second);
411 gfan::ZMatrix interiorPoints = facetsData.first;
412 gfan::ZMatrix facetNormals = facetsData.second;
415 for (
int i=0;
i<interiorPoints.getHeight();
i++)
417 gfan::ZVector
w = interiorPoints[
i];
418 gfan::ZVector
v = facetNormals[
i];
422 if (w[0].
sign()==0 && v[0].
sign()>0)
434 return (!dual.contains(w));
445 for (
int i=0;
i<interiorPoints.getHeight();
i++)
451 for (
int j=0;
j<ray.getHeight();
j++)
455 neighbours.insert(neighbour);
466 if (setOfCones.size() > 0)
468 groebnerCones::iterator sigma = setOfCones.begin();
469 gfan::ZFan* zf =
new gfan::ZFan(sigma->getPolyhedralCone().ambientDimension());
470 for (; sigma!=setOfCones.end(); sigma++)
472 gfan::ZCone zc = sigma->getPolyhedralCone();
479 return new gfan::ZFan(gfan::ZFan(
currRing->N));
implementation of the class tropicalStrategy
const CanonicalForm int s
bool checkOrderingAndCone(const ring r, const gfan::ZCone zc)
gfan::ZCone getPolyhedralCone() const
const tropicalStrategy * currentStrategy
ring getPolynomialRing() const
gfan::ZCone polyhedralCone
bool checkFlipConeInput(const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal) const
Debug tools.
bool checkPolynomialInput(const ideal I, const ring r)
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
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
std::pair< gfan::ZMatrix, gfan::ZMatrix > interiorPointsAndNormalsOfFacets(const gfan::ZCone zc, const std::set< gfan::ZVector > &exceptThesePoints, const bool onlyLowerHalfSpace)
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
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)
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
BOOLEAN inequalities(leftv res, leftv args)
bool checkPolyhedralInput(const gfan::ZCone zc, const gfan::ZVector p)
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
const Variable & v
< [in] a sqrfree bivariate poly
gfan::ZVector interiorPoint
long wDeg(const poly p, const ring r, const gfan::ZVector &w)
various functions to compute the initial form of polynomials and ideals
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...
bool checkWeightVector(const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder)
std::string toString(const gfan::ZCone *const c)
groebnerCone & operator=(const groebnerCone &sigma)
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)
ideal getPolynomialIdeal() const