31 if (i != -1)
pDelete(&vv->m[i]);
59 gfan::ZVector allOnes(n);
60 for (
int i=0;
i<
n;
i++)
62 ring rShortcut =
rCopy0(r);
64 int* order = rShortcut->order;
65 int* block0 = rShortcut->block0;
66 int* block1 = rShortcut->block1;
67 int** wvhdl = rShortcut->wvhdl;
70 rShortcut->order = (
int*)
omAlloc0((h+1)*
sizeof(
int));
71 rShortcut->block0 = (
int*)
omAlloc0((h+1)*
sizeof(
int));
72 rShortcut->block1 = (
int*)
omAlloc0((h+1)*
sizeof(
int));
73 rShortcut->wvhdl = (
int**)
omAlloc0((h+1)*
sizeof(
int*));
75 rShortcut->block0[0] = 1;
76 rShortcut->block1[0] =
n;
79 for (
int i=1;
i<=
h;
i++)
81 rShortcut->order[
i] = order[
i-1];
82 rShortcut->block0[
i] = block0[
i-1];
83 rShortcut->block1[
i] = block1[
i-1];
84 rShortcut->wvhdl[
i] = wvhdl[
i-1];
98 for (
int i=0;
i<
k;
i++)
105 for (
int i=0;
i<
k;
i++)
121 const bool completelyHomogeneous,
122 const bool completeSpace):
123 originalRing(
rCopy(r)),
125 expectedDimension(
dim(originalIdeal,originalRing)),
127 startingRing(
rCopy(originalRing)),
128 startingIdeal(
id_Copy(originalIdeal,originalRing)),
129 uniformizingParameter(
NULL),
131 onlyLowerHalfSpace(
false),
137 if (!completelyHomogeneous)
160 char** oldNames = s->names;
161 s->names = (
char**)
omAlloc((n+1)*
sizeof(
char**));
163 for (
int i=1;
i<
n;
i++)
164 s->names[
i] = oldNames[
i-1];
167 s->order = (
int*)
omAlloc0(3*
sizeof(
int));
168 s->block0 = (
int*)
omAlloc0(3*
sizeof(
int));
169 s->block1 = (
int*)
omAlloc0(3*
sizeof(
int));
170 s->wvhdl = (
int**)
omAlloc0(3*
sizeof(
int**));
174 s->wvhdl[0] = (
int*)
omAlloc(n*
sizeof(
int));
178 for (
int i=1;
i<
n;
i++)
183 for (
int i=1;
i<
n;
i++)
188 for (
int i=1;
i<
n;
i++)
189 s->wvhdl[0][
i] = r->wvhdl[0][
i-1];
193 for (
int i=1;
i<
n;
i++)
194 s->wvhdl[0][
i] = -r->wvhdl[0][
i-1];
207 p_SetCoeff(g,uniformizingParameter,startingRing);
219 int n =
rVar(originalRing);
220 int* shiftByOne = (
int*)
omAlloc((n+1)*
sizeof(
int));
221 for (
int i=1;
i<=
n;
i++)
223 for (
int i=0;
i<
k;
i++)
224 J->m[
i] =
p_PermPoly(originalIdeal->m[
i],shiftByOne,originalRing,startingRing,nMap,
NULL,0);
229 ideal startingIdeal =
kNF(pt,startingRing->qideal,J);
233 startingIdeal->m[
k] = pt->m[0];
239 return startingIdeal;
247 originalRing(
rCopy(s)),
249 expectedDimension(
dim(originalIdeal,originalRing)+1),
253 uniformizingParameter(
NULL),
255 onlyLowerHalfSpace(true),
286 originalRing(
rCopy(currentStrategy.getOriginalRing())),
287 originalIdeal(
id_Copy(currentStrategy.getOriginalIdeal(),currentStrategy.getOriginalRing())),
288 expectedDimension(currentStrategy.getExpectedDimension()),
290 startingRing(
rCopy(currentStrategy.getStartingRing())),
291 startingIdeal(
id_Copy(currentStrategy.getStartingIdeal(),currentStrategy.getStartingRing())),
292 uniformizingParameter(
NULL),
294 onlyLowerHalfSpace(currentStrategy.restrictToLowerHalfSpace()),
295 weightAdjustingAlgorithm1(currentStrategy.weightAdjustingAlgorithm1),
296 weightAdjustingAlgorithm2(currentStrategy.weightAdjustingAlgorithm2),
297 extraReductionAlgorithm(currentStrategy.extraReductionAlgorithm)
351 if (shortcutRing)
rTest(shortcutRing);
377 for (
int i=l;
i>0;
i--)
417 ring rShortcut =
rCopy0(r);
420 int* order = rShortcut->order;
421 int* block0 = rShortcut->block0;
422 int* block1 = rShortcut->block1;
423 int** wvhdl = rShortcut->wvhdl;
428 rShortcut->order = (
int*)
omAlloc0((h+1)*
sizeof(
int));
429 rShortcut->block0 = (
int*)
omAlloc0((h+1)*
sizeof(
int));
430 rShortcut->block1 = (
int*)
omAlloc0((h+1)*
sizeof(
int));
431 rShortcut->wvhdl = (
int**)
omAlloc0((h+1)*
sizeof(
int*));
433 rShortcut->block0[0] = 1;
434 rShortcut->block1[0] =
n;
437 for (
int i=1;
i<=
h;
i++)
439 rShortcut->order[
i] = order[
i-1];
440 rShortcut->block0[
i] = block0[
i-1];
441 rShortcut->block1[
i] = block1[
i-1];
442 rShortcut->wvhdl[
i] = wvhdl[
i-1];
467 for (
int i=0;
i<
k;
i++)
471 return std::pair<poly,int>(
g,
i);
487 for (
int i=0;
i<
k;
i++)
519 return std::pair<poly,int>(monomial,-1);
524 ring rShortcut =
rCopy0(r);
557 for (
int i=0;
i<
k;
i++)
559 for (
int j=0;
j<
l;
j++)
561 id_Test(inJShortcut,rShortcut);
562 id_Test(inIShortcut,rShortcut);
571 for (
int ij=k*l-1; ij>=0; ij--)
581 for (
int j=0;
j<
k;
j++)
584 for (
int i=0;
i<
l;
i++)
594 for (
int i=0;
i<
l;
i++)
626 for (
int i=0;
i<
k;
i++)
634 inJ->m[0] =
p_One(r);
637 for (
int i=0;
i<
k;
i++)
651 for (
int i=0;
i<
k;
i++)
657 for (
int i=0;
i<
k;
i++)
664 if (r->order !=
NULL)
673 for (
int j=0;
j<
i;
j++)
674 if (r->wvhdl[
j]!=
NULL)
692 s->order = (
int*)
omAlloc0(5*
sizeof(
int));
693 s->block0 = (
int*)
omAlloc0(5*
sizeof(
int));
694 s->block1 = (
int*)
omAlloc0(5*
sizeof(
int));
695 s->wvhdl = (
int**)
omAlloc0(5*
sizeof(
int**));
721 s->order = (
int*)
omAlloc0(5*
sizeof(
int));
722 s->block0 = (
int*)
omAlloc0(5*
sizeof(
int));
723 s->block1 = (
int*)
omAlloc0(5*
sizeof(
int));
724 s->wvhdl = (
int**)
omAlloc0(5*
sizeof(
int**));
744 const gfan::ZVector &interiorPoint,
745 const gfan::ZVector &facetNormal)
const
757 for (
int i=0;
i<
k;
i++)
765 identity =
n_SetMap(sAdjusted->cf,r->cf);
766 for (
int i=0;
i<
k;
i++)
773 for (
int i=0;
i<
k;
i++)
786 return std::make_pair(Js,s);
873 expectedDimension(
NULL),
877 uniformizingParameter(
NULL),
879 onlyLowerHalfSpace(
false)
929 number
p = (number) x->
CopyD();
937 res->
data = (
char*) J;
964 number
p = (number) v->
CopyD();
980 delete interiorPoint0;
982 delete interiorPoint;
992 WerrorS(
"computeFlipDebug: unexpected parameters");
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
implementation of the class tropicalStrategy
ring getOriginalRing() const
returns the polynomial ring over the field with valuation
const CanonicalForm int s
int findPositionOfUniformizingBinomial(const ideal I, const ring r) const
matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
Computes a division discarding remainder of f with respect to G.
ideal getOriginalIdeal() const
returns the input ideal over the field with valuation
Class used for (list of) interpreter objects.
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
gfan::ZCone homogeneitySpace(ideal I, ring r)
bool isValuationNonTrivial() const
gfan::ZVector nonvalued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &)
ideal computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
suppose w a weight in maximal groebner cone of > suppose I (initially) reduced standard basis w...
bool isOrderingLocalInT(const ring r)
ideal id_Copy(ideal h1, const ring r)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
bool ppreduceInitially(poly *hStar, const poly g, const ring r)
reduces h initially with respect to g, returns false if h was initially reduced in the first place...
BOOLEAN computeFlipDebug(leftv res, leftv args)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
#define omFreeSize(addr, size)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
poly p_Div_nn(poly p, const number n, const ring r)
void pReduce(ideal I, const ring r) const
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 ...
static ideal constructStartingIdeal(ideal originalIdeal, ring originalRing, number uniformizingParameter, ring startingRing)
bool onlyLowerHalfSpace
true if valuation non-trivial, false otherwise
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
void WerrorS(const char *s)
static tropicalStrategy debugStrategy(const ideal startIdeal, number unifParameter, ring startRing)
ring getStartingRing() const
returns the polynomial ring over the valuation ring
BOOLEAN computeWitnessDebug(leftv res, leftv args)
static number p_SetCoeff(poly p, number n, ring r)
static void swapElements(ideal I, ideal J)
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
static ring constructStartingRing(ring r)
Given a polynomial ring r over the rational numbers and a weighted ordering, returns a polynomial rin...
static poly p_Copy(poly p, const ring r)
returns a copy of p
ideal startingIdeal
preimage of the input ideal under the map that sends t to the uniformizing parameter ...
~tropicalStrategy()
destructor
ring copyAndChangeCoefficientRing(const ring r) 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 ...
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
static int rBlocks(ring r)
BOOLEAN linealitySpace(leftv res, leftv args)
ideal originalIdeal
input ideal, assumed to be a homogeneous prime ideal
static bool noExtraReduction(ideal I, ring r, number)
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
ring getShortcutRing() const
ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const
given generators of the initial ideal, computes its standard basis
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...
ring shortcutRing
polynomial ring over the residue field
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
static void deleteOrdering(ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
ideal getStartingIdeal() const
returns the input ideal
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 ...
int scDimInt(ideal S, ideal Q)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
ring getShortcutRingPrependingWeight(const ring r, const gfan::ZVector &w) const
If valuation trivial, returns a copy of r with a positive weight prepended, such that any ideal homog...
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
void idDelete(ideal *h, ring r=currRing)
delete an ideal
void putUniformizingBinomialInFront(ideal I, const ring r, const number q) const
poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r)
only used if HAVE_RINGS is defined: ?
ring copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
static BOOLEAN rField_is_Q(const ring r)
gfan::ZVector(* weightAdjustingAlgorithm2)(const gfan::ZVector &v, const gfan::ZVector &w)
A function such that: Given strictly positive weight w and weight v, returns a strictly positive weig...
void mp_Delete(matrix *a, const ring r)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void idSkipZeroes(ideal ide)
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...
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
gfan::ZVector valued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &w)
void rChangeCurrRing(ring r)
static BOOLEAN rField_is_Zp(const ring r)
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
matrix mpNew(int r, int c)
create a r x c zero-matrix
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
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
number uniformizingParameter
uniformizing parameter in the valuation ring
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
ring startingRing
polynomial ring over the valuation ring extended by one extra variable t
static BOOLEAN rField_is_Ring(const ring r)
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.
ring copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
bool(* extraReductionAlgorithm)(ideal I, ring r, number p)
A function that reduces the generators of an ideal I so that the inequalities and equations of the Gr...
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
void rDelete(ring r)
unconditionally deletes fields in r
bool checkForUniformizingBinomial(const ideal I, const ring r) const
if valuation non-trivial, checks whether the generating system contains p-t otherwise returns true ...
static BOOLEAN rField_is_Ring_Z(const ring r)
gfan::ZVector nonvalued_adjustWeightForHomogeneity(const gfan::ZVector &w)
gfan::ZVector valued_adjustWeightForHomogeneity(const gfan::ZVector &w)
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...
ideal id_Head(ideal h, const ring r)
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
static void p_Setm(poly p, const ring r)
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
static poly p_Neg(poly p, const ring r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
ring originalRing
polynomial ring over a field with valuation
static poly p_Add_q(poly p, poly q, const ring r)
tropicalStrategy & operator=(const tropicalStrategy ¤tStrategy)
assignment operator
gfan::ZCone linealitySpace
the homogeneity space of the Grobner fan
void nKillChar(coeffs r)
undo all initialisations
static poly p_Mult_q(poly p, poly q, const ring r)
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
int expectedDimension
the expected Dimension of the polyhedral output, i.e.
bool checkForUniformizingParameter(const ideal inI, const ring r) const
if valuation non-trivial, checks whether the genearting system contains p otherwise returns true ...
gfan::ZVector(* weightAdjustingAlgorithm1)(const gfan::ZVector &w)
A function such that: Given weight w, returns a strictly positive weight u such that an ideal satisfy...
#define MATELEM(mat, i, j)
bool isValuationTrivial() const
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL