 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
23 int dim(ideal I, ring r)
67 gfan::ZVector allOnes(n);
68 for (
int i=0;
i<n;
i++)
70 ring rShortcut =
rCopy0(r);
73 int* block0 = rShortcut->block0;
74 int* block1 = rShortcut->block1;
75 int** wvhdl = rShortcut->wvhdl;
79 rShortcut->block0 = (
int*)
omAlloc0((
h+2)*
sizeof(int));
80 rShortcut->block1 = (
int*)
omAlloc0((
h+2)*
sizeof(int));
81 rShortcut->wvhdl = (
int**)
omAlloc0((
h+2)*
sizeof(
int*));
83 rShortcut->block0[0] = 1;
84 rShortcut->block1[0] = n;
87 for (
int i=1;
i<=
h;
i++)
89 rShortcut->order[
i] = order[
i-1];
90 rShortcut->block0[
i] = block0[
i-1];
91 rShortcut->block1[
i] = block1[
i-1];
92 rShortcut->wvhdl[
i] = wvhdl[
i-1];
110 for (
int i=0;
i<
k;
i++)
122 for (
int i=0;
i<
k;
i++)
139 const bool completelyHomogeneous,
140 const bool completeSpace):
141 originalRing(
rCopy(r)),
143 expectedDimension(
dim(originalIdeal,originalRing)),
145 startingRing(
rCopy(originalRing)),
146 startingIdeal(
id_Copy(originalIdeal,originalRing)),
147 uniformizingParameter(
NULL),
149 onlyLowerHalfSpace(
false),
155 if (!completelyHomogeneous)
178 char** oldNames =
s->names;
179 s->names = (
char**)
omAlloc((n+1)*
sizeof(
char**));
181 for (
int i=1;
i<n;
i++)
182 s->names[
i] = oldNames[
i-1];
186 s->block0 = (
int*)
omAlloc0(3*
sizeof(
int));
187 s->block1 = (
int*)
omAlloc0(3*
sizeof(
int));
188 s->wvhdl = (
int**)
omAlloc0(3*
sizeof(
int**));
192 s->wvhdl[0] = (
int*)
omAlloc(n*
sizeof(
int));
204 for (
int i=1;
i<n;
i++)
209 for (
int i=1;
i<n;
i++)
214 for (
int i=1;
i<n;
i++)
215 s->wvhdl[0][
i] = r->wvhdl[0][
i-1];
219 for (
int i=1;
i<n;
i++)
220 s->wvhdl[0][
i] = -r->wvhdl[0][
i-1];
229 static ideal
constructStartingIdeal(ideal originalIdeal, ring originalRing, number uniformizingParameter, ring startingRing)
232 poly
g =
p_One(startingRing);
245 int n =
rVar(originalRing);
246 int* shiftByOne = (
int*)
omAlloc((n+1)*
sizeof(int));
247 for (
int i=1;
i<=n;
i++)
249 for (
int i=0;
i<
k;
i++)
251 if(originalIdeal->m[
i]!=
NULL)
253 J->m[
i] =
p_PermPoly(originalIdeal->m[
i],shiftByOne,originalRing,startingRing,nMap,
NULL,0);
260 ideal startingIdeal =
kNF(pt,startingRing->qideal,J);
264 startingIdeal->m[
k] = pt->m[0];
270 return startingIdeal;
280 expectedDimension(
dim(originalIdeal,originalRing)+1),
284 uniformizingParameter(
NULL),
286 onlyLowerHalfSpace(true),
317 originalRing(
rCopy(currentStrategy.getOriginalRing())),
318 originalIdeal(
id_Copy(currentStrategy.getOriginalIdeal(),currentStrategy.getOriginalRing())),
319 expectedDimension(currentStrategy.getExpectedDimension()),
321 startingRing(
rCopy(currentStrategy.getStartingRing())),
322 startingIdeal(
id_Copy(currentStrategy.getStartingIdeal(),currentStrategy.getStartingRing())),
323 uniformizingParameter(
NULL),
325 onlyLowerHalfSpace(currentStrategy.restrictToLowerHalfSpace()),
326 weightAdjustingAlgorithm1(currentStrategy.weightAdjustingAlgorithm1),
327 weightAdjustingAlgorithm2(currentStrategy.weightAdjustingAlgorithm2),
328 extraReductionAlgorithm(currentStrategy.extraReductionAlgorithm)
408 for (
int i=
l;
i>0;
i--)
452 int* block0 = rShortcut->block0;
453 int* block1 = rShortcut->block1;
454 int** wvhdl = rShortcut->wvhdl;
460 rShortcut->block0 = (
int*)
omAlloc0((
h+2)*
sizeof(int));
461 rShortcut->block1 = (
int*)
omAlloc0((
h+2)*
sizeof(int));
462 rShortcut->wvhdl = (
int**)
omAlloc0((
h+2)*
sizeof(
int*));
464 rShortcut->block0[0] = 1;
465 rShortcut->block1[0] = n;
468 for (
int i=1;
i<=
h;
i++)
470 rShortcut->order[
i] = order[
i-1];
471 rShortcut->block0[
i] = block0[
i-1];
472 rShortcut->block1[
i] = block1[
i-1];
473 rShortcut->wvhdl[
i] = wvhdl[
i-1];
498 for (
int i=0;
i<
k;
i++)
504 return std::pair<poly,int>(
g,
i);
520 for (
int i=0;
i<
k;
i++)
533 gfan::ZCone pos = gfan::ZCone::positiveOrthant(C0.ambientDimension());
534 gfan::ZCone C0pos = intersection(C0,pos);
535 C0pos.canonicalize();
536 gfan::ZVector wpos = C0pos.getRelativeInteriorPoint();
542 poly monomial =
NULL;
559 return std::pair<poly,int>(monomial,-1);
597 for (
int i=0;
i<
k;
i++)
599 for (
int j=0;
j<
l;
j++)
601 id_Test(inJShortcut,rShortcut);
602 id_Test(inIShortcut,rShortcut);
611 for (
int ij=
k*
l-1; ij>=0; ij--)
621 for (
int j=0;
j<
k;
j++)
624 for (
int i=0;
i<
l;
i++)
627 poly inIi =
p_Copy(inI->m[
i],r);
634 for (
int i=0;
i<
l;
i++)
666 for (
int i=0;
i<
k;
i++)
674 inJ->m[0] =
p_One(r);
677 for (
int i=0;
i<
k;
i++)
691 for (
int i=0;
i<
k;
i++)
697 for (
int i=0;
i<
k;
i++)
711 s->block0 = (
int*)
omAlloc0(5*
sizeof(
int));
712 s->block1 = (
int*)
omAlloc0(5*
sizeof(
int));
713 s->wvhdl = (
int**)
omAlloc0(5*
sizeof(
int**));
739 s->block0 = (
int*)
omAlloc0(5*
sizeof(
int));
740 s->block1 = (
int*)
omAlloc0(5*
sizeof(
int));
741 s->wvhdl = (
int**)
omAlloc0(5*
sizeof(
int**));
761 const gfan::ZVector &interiorPoint,
762 const gfan::ZVector &facetNormal)
const
770 ideal inIr =
initial(Ir,r,interiorPoint);
774 ideal inIsAdjusted =
idInit(
k);
775 for (
int i=0;
i<
k;
i++)
783 identity =
n_SetMap(sAdjusted->cf,r->cf);
784 for (
int i=0;
i<
k;
i++)
791 for (
int i=0;
i<
k;
i++)
808 return std::make_pair(Js,
s);
ideal originalIdeal
input ideal, assumed to be a homogeneous prime ideal
bool isValuationTrivial() const
void pReduce(ideal I, const ring r) const
gfan::ZVector adjustWeightForHomogeneity(gfan::ZVector w) const
Given weight w, returns a strictly positive weight u such that an ideal satisfying the valuation-sepc...
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
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...
ring copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
#define idDelete(H)
delete an ideal
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
#define MATELEM(mat, i, j)
void rChangeCurrRing(ring r)
bool checkForUniformizingParameter(const ideal inI, const ring r) const
if valuation non-trivial, checks whether the genearting system contains p otherwise returns true
ring copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
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 poly p_Neg(poly p, const ring r)
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 ...
bool isOrderingLocalInT(const ring r)
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...
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,...
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
number uniformizingParameter
uniformizing parameter in the valuation ring
ring startingRing
polynomial ring over the valuation ring extended by one extra variable t
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
bool isValuationNonTrivial() const
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
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 getOriginalIdeal() const
returns the input ideal over the field with valuation
BOOLEAN linealitySpace(leftv res, leftv args)
int scDimInt(ideal S, ideal Q)
bool checkWeightVector(const ideal I, const ring r, const gfan::ZVector &weightVector, bool checkBorder)
ring originalRing
polynomial ring over a field with valuation
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
static poly p_Copy(poly p, const ring r)
returns a copy of p
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
static short rVar(const ring r)
#define rVar(r) (r->N)
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...
tropicalStrategy(const ideal I, const ring r, const bool completelyHomogeneous=true, const bool completeSpace=true)
Constructor for the trivial valuation case.
gfan::ZCone linealitySpace
the homogeneity space of the Grobner fan
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
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)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
#define omFreeSize(addr, size)
ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const
given generators of the initial ideal, computes its standard basis
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
Computes a division discarding remainder of f with respect to G.
static BOOLEAN rField_is_Ring(const ring r)
poly p_Div_nn(poly p, const number n, const ring r)
tropicalStrategy & operator=(const tropicalStrategy ¤tStrategy)
assignment operator
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...
ring getShortcutRing() const
int expectedDimension
the expected Dimension of the polyhedral output, i.e.
@ n_Z
only used if HAVE_RINGS is defined
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...
gfan::ZCone homogeneitySpace(ideal I, ring r)
int findPositionOfUniformizingBinomial(const ideal I, const ring r) const
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
void putUniformizingBinomialInFront(ideal I, const ring r, const number q) const
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
void mp_Delete(matrix *a, const ring r)
static ring constructStartingRing(ring r)
Given a polynomial ring r over the rational numbers and a weighted ordering, returns a polynomial rin...
static int rBlocks(ring r)
ring getOriginalRing() const
returns the polynomial ring over the field with valuation
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....
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
matrix mpNew(int r, int c)
create a r x c zero-matrix
gfan::ZVector nonvalued_adjustWeightForHomogeneity(const gfan::ZVector &w)
ring copyAndChangeCoefficientRing(const ring r) const
bool checkForNonPositiveEntries(const gfan::ZVector &w)
void rDelete(ring r)
unconditionally deletes fields in r
static bool noExtraReduction(ideal I, ring r, number)
ring getStartingRing() const
returns the polynomial ring over the valuation ring
static void p_Delete(poly *p, const ring r)
static poly p_Add_q(poly p, poly q, const ring r)
poly searchForMonomialViaStepwiseSaturation(const ideal I, const ring r, const gfan::ZVector w0)
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static ideal constructStartingIdeal(ideal originalIdeal, ring originalRing, number uniformizingParameter, ring startingRing)
ideal idInit(int idsize, int rank)
initialise an ideal / module
static number p_SetCoeff(poly p, number n, ring r)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
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 ....
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.
bool onlyLowerHalfSpace
true if valuation non-trivial, false otherwise
static void p_Setm(poly p, const ring r)
const Variable & v
< [in] a sqrfree bivariate poly
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
gfan::ZVector valued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &w)
gfan::ZVector nonvalued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &)
const CanonicalForm int s
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static poly p_Mult_q(poly p, poly q, const ring r)
static BOOLEAN rField_is_Z(const ring r)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
static BOOLEAN rField_is_Zp(const ring r)
ideal startingIdeal
preimage of the input ideal under the map that sends t to the uniformizing parameter
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
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
ring shortcutRing
polynomial ring over the residue field
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.
~tropicalStrategy()
destructor
ideal getStartingIdeal() const
returns the input ideal
void nKillChar(coeffs r)
undo all initialisations
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
static void swapElements(ideal I, ideal J)
static BOOLEAN rField_is_Q(const ring r)
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...
gfan::ZVector valued_adjustWeightForHomogeneity(const gfan::ZVector &w)