1 #include <gfanlib/gfanlib_matrix.h> 2 #include <gfanlib/gfanlib_zcone.h> 31 for (ZConesSortedByDimension::iterator coneOfA=setA.begin(); coneOfA!=setA.end(); coneOfA++)
33 for (ZConesSortedByDimension::iterator coneOfB=setB.begin(); coneOfB!=setB.end(); coneOfB++)
35 gfan::ZCone coneOfIntersection = gfan::intersection(*coneOfA,*coneOfB);
36 if (coneOfIntersection.dimension()>=d)
38 coneOfIntersection.canonicalize();
39 setAB.insert(coneOfIntersection);
57 int h = W.getHeight();
62 s->order = (
int*)
omAlloc0((h+4)*
sizeof(int));
64 s->block0 = (
int*)
omAlloc0((h+4)*
sizeof(int));
66 s->block1 = (
int*)
omAlloc0((h+4)*
sizeof(int));
67 for (
int j=0; s->wvhdl[
j];
j++)
omFree(s->wvhdl[
j]);
69 s->wvhdl = (
int**)
omAlloc0((h+4)*
sizeof(
int*));
72 bool overflow =
false;
83 for (
int j=0;
j<h-1;
j++)
100 WerrorS(
"genericlyWeightedOrdering: overflow in weight vector");
125 for (
int i=1;
i<
k;
i++)
138 for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end();)
140 gfan::ZVector
w = zc->getRelativeInteriorPoint();
141 gfan::ZMatrix W = zc->generatorsOfSpan();
147 for (
int j=0;
j<
k;
j++)
152 ideal ininIs =
initial(inIsSTD,s,w,W);
156 if (mons.first!=
NULL)
161 gs = inIsSTD->m[mons.second];
164 gs =
witness(mons.first,inIsSTD,ininIs,s);
192 if (zc->contains(wNeg))
197 for (
int j=0;
j<
k;
j++)
202 ininIs =
initial(inIsSTD,s,wNeg,W);
205 if (mons.first!=
NULL)
210 gs = inIsSTD->m[mons.second];
213 gs =
witness(mons.first,inIsSTD,ininIs,s);
251 gfan::ZMatrix raysOfC(0,u.size());
254 for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
256 assume(zc->dimensionOfLinealitySpace()+1 >= zc->dimension());
257 if (zc->dimensionOfLinealitySpace()+1 >= zc->dimension())
258 raysOfC.appendRow(zc->getRelativeInteriorPoint());
261 gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
264 raysOfC.appendRow(interiorPoint);
265 raysOfC.appendRow(currentStrategy->
negateWeight(interiorPoint));
269 gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
270 for (
int i=0;
i<zm.getHeight();
i++)
272 gfan::ZVector point = zm[
i];
275 raysOfC.appendRow(point);
276 raysOfC.appendRow(currentStrategy->
negateWeight(point));
286 for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
288 assume(zc->dimensionOfLinealitySpace()+2 >= zc->dimension());
289 if (zc->dimensionOfLinealitySpace()+2 == zc->dimension())
290 raysOfC.appendRow(zc->getRelativeInteriorPoint());
293 gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
296 raysOfC.appendRow(interiorPoint);
297 raysOfC.appendRow(currentStrategy->
negateWeight(interiorPoint));
301 gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
302 for (
int i=0;
i<zm.getHeight();
i++)
304 gfan::ZVector point = zm[
i];
307 raysOfC.appendRow(point);
308 raysOfC.appendRow(currentStrategy->
negateWeight(point));
335 ideal inI = (ideal) u->
CopyD();
350 WerrorS(
"tropicalStarDebug: unexpected parameters");
implementation of the class tropicalStrategy
const CanonicalForm int s
Class used for (list of) interpreter objects.
static ring genericlyWeightedOrdering(const ring r, const gfan::ZVector &u, const gfan::ZVector &w, const gfan::ZMatrix &W, const tropicalStrategy *currentStrategy)
ZConesSortedByDimension tropicalVarietySortedByDimension(const poly g, const ring r, const tropicalStrategy *currentCase)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
void WerrorS(const char *s)
gfan::ZVector negateWeight(const gfan::ZVector &w) const
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
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 ...
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
std::set< gfan::ZCone, ZConeCompareDimensionFirst > ZConesSortedByDimension
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
bool homogeneitySpaceContains(const gfan::ZVector &v) const
returns true, if v is contained in the homogeneity space; false otherwise
static ZConesSortedByDimension intersect(const ZConesSortedByDimension &setA, const ZConesSortedByDimension &setB, int d=0)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
gfan::ZVector adjustWeightUnderHomogeneity(gfan::ZVector v, gfan::ZVector w) const
Given strictly positive weight w and weight v, returns a strictly positive weight u such that on an i...
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
ZConesSortedByDimension tropicalStar(ideal inI, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
gfan::ZVector adjustWeightForHomogeneity(gfan::ZVector w) const
Given weight w, returns a strictly positive weight u such that an ideal satisfying the valuation-sepc...
const Variable & v
< [in] a sqrfree bivariate poly
poly witness(const poly m, const ideal I, const ideal inI, const ring r)
Let w be the uppermost weight vector in the matrix defining the ordering on r.
void rDelete(ring r)
unconditionally deletes fields in r
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...
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
BOOLEAN tropicalStarDebug(leftv res, leftv args)
gfan::ZMatrix raysOfTropicalStar(ideal I, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)