All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tropicalStrategy.cc
Go to the documentation of this file.
1 #include <tropicalStrategy.h>
2 #include <adjustWeights.h>
3 #include <ppinitialReduction.h>
4 // #include <ttinitialReduction.h>
5 #include <tropical.h>
6 #include <std_wrapper.h>
7 #include <tropicalCurves.h>
8 
9 // for various commands in dim(ideal I, ring r):
10 #include <kernel/ideals.h>
12 #include <kernel/GBEngine/kstd1.h>
13 #include <misc/prime.h> // for isPrime(int i)
14 
15 /***
16  * Computes the dimension of an ideal I in ring r
17  * Copied from jjDim in iparith.cc
18  **/
19 int dim(ideal I, ring r)
20 {
21  ring origin = currRing;
22  if (origin != r)
23  rChangeCurrRing(r);
24  int d;
26  {
27  int i = idPosConstant(I);
28  if ((i != -1)
29  #ifdef HAVE_RINGS
30  && (n_IsUnit(p_GetCoeff(I->m[i],currRing->cf),currRing->cf))
31  #endif
32  )
33  return -1;
34  ideal vv = id_Head(I,currRing);
35  if (i != -1) pDelete(&vv->m[i]);
36  d = scDimInt(vv, currRing->qideal);
37  if (rField_is_Ring_Z(currRing) && (i==-1)) d++;
38  idDelete(&vv);
39  return d;
40  }
41  else
42  d = scDimInt(I,currRing->qideal);
43  if (origin != r)
44  rChangeCurrRing(origin);
45  return d;
46 }
47 
48 static void swapElements(ideal I, ideal J)
49 {
50  assume(IDELEMS(I)==IDELEMS(J));
51 
52  for (int i=IDELEMS(I)-1; i>=0; i--)
53  {
54  poly cache = I->m[i];
55  I->m[i] = J->m[i];
56  J->m[i] = cache;
57  }
58 }
59 
60 static bool noExtraReduction(ideal I, ring r, number /*p*/)
61 {
62  int n = rVar(r);
63  gfan::ZVector allOnes(n);
64  for (int i=0; i<n; i++)
65  allOnes[i] = 1;
66  ring rShortcut = rCopy0(r);
67 
68  int* order = rShortcut->order;
69  int* block0 = rShortcut->block0;
70  int* block1 = rShortcut->block1;
71  int** wvhdl = rShortcut->wvhdl;
72 
73  int h = rBlocks(r);
74  rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
75  rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
76  rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
77  rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
78  rShortcut->order[0] = ringorder_a;
79  rShortcut->block0[0] = 1;
80  rShortcut->block1[0] = n;
81  bool overflow;
82  rShortcut->wvhdl[0] = ZVectorToIntStar(allOnes,overflow);
83  for (int i=1; i<=h; i++)
84  {
85  rShortcut->order[i] = order[i-1];
86  rShortcut->block0[i] = block0[i-1];
87  rShortcut->block1[i] = block1[i-1];
88  rShortcut->wvhdl[i] = wvhdl[i-1];
89  }
90 
91  rComplete(rShortcut);
92  rTest(rShortcut);
93 
94  omFree(order);
95  omFree(block0);
96  omFree(block1);
97  omFree(wvhdl);
98 
99  int k = IDELEMS(I);
100  ideal IShortcut = idInit(k);
101  nMapFunc intoShortcut = n_SetMap(r->cf,rShortcut->cf);
102  for (int i=0; i<k; i++)
103  {
104  if(I->m[i]!=NULL)
105  {
106  IShortcut->m[i] = p_PermPoly(I->m[i],NULL,r,rShortcut,intoShortcut,NULL,0);
107  }
108  }
109 
110  ideal JShortcut = gfanlib_kStd_wrapper(IShortcut,rShortcut);
111 
112  ideal J = idInit(k);
113  nMapFunc outofShortcut = n_SetMap(rShortcut->cf,r->cf);
114  for (int i=0; i<k; i++)
115  J->m[i] = p_PermPoly(JShortcut->m[i],NULL,rShortcut,r,outofShortcut,NULL,0);
116 
117  swapElements(I,J);
118  id_Delete(&IShortcut,rShortcut);
119  id_Delete(&JShortcut,rShortcut);
120  rDelete(rShortcut);
121  id_Delete(&J,r);
122  return false;
123 }
124 
125 /**
126  * Initializes all relevant structures and information for the trivial valuation case,
127  * i.e. computing a tropical variety without any valuation.
128  */
129 tropicalStrategy::tropicalStrategy(const ideal I, const ring r,
130  const bool completelyHomogeneous,
131  const bool completeSpace):
132  originalRing(rCopy(r)),
133  originalIdeal(id_Copy(I,r)),
134  expectedDimension(dim(originalIdeal,originalRing)),
135  linealitySpace(homogeneitySpace(originalIdeal,originalRing)),
136  startingRing(rCopy(originalRing)),
137  startingIdeal(id_Copy(originalIdeal,originalRing)),
138  uniformizingParameter(NULL),
139  shortcutRing(NULL),
140  onlyLowerHalfSpace(false),
141  weightAdjustingAlgorithm1(nonvalued_adjustWeightForHomogeneity),
142  weightAdjustingAlgorithm2(nonvalued_adjustWeightUnderHomogeneity),
143  extraReductionAlgorithm(noExtraReduction)
144 {
146  if (!completelyHomogeneous)
147  {
150  }
151  if (!completeSpace)
152  onlyLowerHalfSpace = true;
153 }
154 
155 /**
156  * Given a polynomial ring r over the rational numbers and a weighted ordering,
157  * returns a polynomial ring s over the integers with one extra variable, which is weighted -1.
158  */
159 static ring constructStartingRing(ring r)
160 {
161  assume(rField_is_Q(r));
162 
163  ring s = rCopy0(r,FALSE,FALSE);
164  nKillChar(s->cf);
165  s->cf = nInitChar(n_Z,NULL);
166 
167  int n = rVar(s)+1;
168  s->N = n;
169  char** oldNames = s->names;
170  s->names = (char**) omAlloc((n+1)*sizeof(char**));
171  s->names[0] = omStrDup("t");
172  for (int i=1; i<n; i++)
173  s->names[i] = oldNames[i-1];
174  omFree(oldNames);
175 
176  s->order = (int*) omAlloc0(3*sizeof(int));
177  s->block0 = (int*) omAlloc0(3*sizeof(int));
178  s->block1 = (int*) omAlloc0(3*sizeof(int));
179  s->wvhdl = (int**) omAlloc0(3*sizeof(int**));
180  s->order[0] = ringorder_ws;
181  s->block0[0] = 1;
182  s->block1[0] = n;
183  s->wvhdl[0] = (int*) omAlloc(n*sizeof(int));
184  s->wvhdl[0][0] = 1;
185  if (r->order[0] == ringorder_lp)
186  {
187  s->wvhdl[0][1] = 1;
188  }
189  else if (r->order[0] == ringorder_ls)
190  {
191  s->wvhdl[0][1] = -1;
192  }
193  else if (r->order[0] == ringorder_dp)
194  {
195  for (int i=1; i<n; i++)
196  s->wvhdl[0][i] = -1;
197  }
198  else if (r->order[0] == ringorder_ds)
199  {
200  for (int i=1; i<n; i++)
201  s->wvhdl[0][i] = 1;
202  }
203  else if (r->order[0] == ringorder_ws)
204  {
205  for (int i=1; i<n; i++)
206  s->wvhdl[0][i] = r->wvhdl[0][i-1];
207  }
208  else
209  {
210  for (int i=1; i<n; i++)
211  s->wvhdl[0][i] = -r->wvhdl[0][i-1];
212  }
213  s->order[1] = ringorder_C;
214 
215  rComplete(s);
216  rTest(s);
217  return s;
218 }
219 
220 static ideal constructStartingIdeal(ideal originalIdeal, ring originalRing, number uniformizingParameter, ring startingRing)
221 {
222  // construct p-t
223  poly g = p_One(startingRing);
224  p_SetCoeff(g,uniformizingParameter,startingRing);
225  pNext(g) = p_One(startingRing);
226  p_SetExp(pNext(g),1,1,startingRing);
227  p_SetCoeff(pNext(g),n_Init(-1,startingRing->cf),startingRing);
228  p_Setm(pNext(g),startingRing);
229  ideal pt = idInit(1);
230  pt->m[0] = g;
231 
232  // map originalIdeal from originalRing into startingRing
233  int k = IDELEMS(originalIdeal);
234  ideal J = idInit(k+1);
235  nMapFunc nMap = n_SetMap(originalRing->cf,startingRing->cf);
236  int n = rVar(originalRing);
237  int* shiftByOne = (int*) omAlloc((n+1)*sizeof(int));
238  for (int i=1; i<=n; i++)
239  shiftByOne[i]=i+1;
240  for (int i=0; i<k; i++)
241  {
242  if(originalIdeal->m[i]!=NULL)
243  {
244  J->m[i] = p_PermPoly(originalIdeal->m[i],shiftByOne,originalRing,startingRing,nMap,NULL,0);
245  }
246  }
247  omFreeSize(shiftByOne,(n+1)*sizeof(int));
248 
249  ring origin = currRing;
250  rChangeCurrRing(startingRing);
251  ideal startingIdeal = kNF(pt,startingRing->qideal,J); // mathematically redundant,
252  rChangeCurrRing(origin); // but helps with upcoming std computation
253  // ideal startingIdeal = J; J = NULL;
254  assume(startingIdeal->m[k]==NULL);
255  startingIdeal->m[k] = pt->m[0];
256  startingIdeal = gfanlib_kStd_wrapper(startingIdeal,startingRing);
257 
258  id_Delete(&J,startingRing);
259  pt->m[0] = NULL;
260  id_Delete(&pt,startingRing);
261  return startingIdeal;
262 }
263 
264 /***
265  * Initializes all relevant structures and information for the valued case,
266  * i.e. computing a tropical variety over the rational numbers with p-adic valuation
267  **/
268 tropicalStrategy::tropicalStrategy(ideal J, number q, ring s):
269  originalRing(rCopy(s)),
270  originalIdeal(id_Copy(J,s)),
271  expectedDimension(dim(originalIdeal,originalRing)+1),
272  linealitySpace(gfan::ZCone()), // to come, see below
273  startingRing(NULL), // to come, see below
274  startingIdeal(NULL), // to come, see below
275  uniformizingParameter(NULL), // to come, see below
276  shortcutRing(NULL), // to come, see below
277  onlyLowerHalfSpace(true),
278  weightAdjustingAlgorithm1(valued_adjustWeightForHomogeneity),
279  weightAdjustingAlgorithm2(valued_adjustWeightUnderHomogeneity),
280  extraReductionAlgorithm(ppreduceInitially)
281 {
282  /* assume that the ground field of the originalRing is Q */
283  assume(rField_is_Q(s));
284 
285  /* replace Q with Z for the startingRing
286  * and add an extra variable for tracking the uniformizing parameter */
288 
289  /* map the uniformizing parameter into the new coefficient domain */
290  nMapFunc nMap = n_SetMap(originalRing->cf,startingRing->cf);
292 
293  /* map the input ideal into the new polynomial ring */
296 
298 
299  /* construct the shorcut ring */
301  nKillChar(shortcutRing->cf);
305 }
306 
308  originalRing(rCopy(currentStrategy.getOriginalRing())),
309  originalIdeal(id_Copy(currentStrategy.getOriginalIdeal(),currentStrategy.getOriginalRing())),
310  expectedDimension(currentStrategy.getExpectedDimension()),
311  linealitySpace(currentStrategy.getHomogeneitySpace()),
312  startingRing(rCopy(currentStrategy.getStartingRing())),
313  startingIdeal(id_Copy(currentStrategy.getStartingIdeal(),currentStrategy.getStartingRing())),
314  uniformizingParameter(NULL),
315  shortcutRing(NULL),
316  onlyLowerHalfSpace(currentStrategy.restrictToLowerHalfSpace()),
317  weightAdjustingAlgorithm1(currentStrategy.weightAdjustingAlgorithm1),
318  weightAdjustingAlgorithm2(currentStrategy.weightAdjustingAlgorithm2),
319  extraReductionAlgorithm(currentStrategy.extraReductionAlgorithm)
320 {
325  if (currentStrategy.getUniformizingParameter())
326  {
329  }
330  if (currentStrategy.getShortcutRing())
331  {
332  shortcutRing = rCopy(currentStrategy.getShortcutRing());
334  }
335 }
336 
338 {
345 
352 }
353 
355 {
356  originalRing = rCopy(currentStrategy.getOriginalRing());
357  originalIdeal = id_Copy(currentStrategy.getOriginalIdeal(),currentStrategy.getOriginalRing());
358  expectedDimension = currentStrategy.getExpectedDimension();
359  startingRing = rCopy(currentStrategy.getStartingRing());
360  startingIdeal = id_Copy(currentStrategy.getStartingIdeal(),currentStrategy.getStartingRing());
362  shortcutRing = rCopy(currentStrategy.getShortcutRing());
363  onlyLowerHalfSpace = currentStrategy.restrictToLowerHalfSpace();
367 
369  if (originalIdeal) id_Test(originalIdeal,originalRing);
371  if (startingIdeal) id_Test(startingIdeal,startingRing);
372  if (uniformizingParameter) n_Test(uniformizingParameter,startingRing->cf);
373  if (shortcutRing) rTest(shortcutRing);
374 
375  return *this;
376 }
377 
378 void tropicalStrategy::putUniformizingBinomialInFront(ideal I, const ring r, const number q) const
379 {
380  poly p = p_One(r);
381  p_SetCoeff(p,q,r);
382  poly t = p_One(r);
383  p_SetExp(t,1,1,r);
384  p_Setm(t,r);
385  poly pt = p_Add_q(p,p_Neg(t,r),r);
386 
387  int k = IDELEMS(I);
388  int l;
389  for (l=0; l<k; l++)
390  {
391  if (p_EqualPolys(I->m[l],pt,r))
392  break;
393  }
394  p_Delete(&pt,r);
395 
396  if (l>1)
397  {
398  pt = I->m[l];
399  for (int i=l; i>0; i--)
400  I->m[l] = I->m[l-1];
401  I->m[0] = pt;
402  pt = NULL;
403  }
404  return;
405 }
406 
407 bool tropicalStrategy::reduce(ideal I, const ring r) const
408 {
409  rTest(r);
410  id_Test(I,r);
411 
412  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
413  number p = identity(uniformizingParameter,startingRing->cf,r->cf);
414  bool b = extraReductionAlgorithm(I,r,p);
415  // putUniformizingBinomialInFront(I,r,p);
416  n_Delete(&p,r->cf);
417 
418  return b;
419 }
420 
421 void tropicalStrategy::pReduce(ideal I, const ring r) const
422 {
423  rTest(r);
424  id_Test(I,r);
425 
426  if (isValuationTrivial())
427  return;
428 
429  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
430  number p = identity(uniformizingParameter,startingRing->cf,r->cf);
431  ::pReduce(I,p,r);
432  n_Delete(&p,r->cf);
433 
434  return;
435 }
436 
437 ring tropicalStrategy::getShortcutRingPrependingWeight(const ring r, const gfan::ZVector &v) const
438 {
439  ring rShortcut = rCopy0(r);
440 
441  // save old ordering
442  int* order = rShortcut->order;
443  int* block0 = rShortcut->block0;
444  int* block1 = rShortcut->block1;
445  int** wvhdl = rShortcut->wvhdl;
446 
447  // adjust weight and create new ordering
448  gfan::ZVector w = adjustWeightForHomogeneity(v);
449  int h = rBlocks(r); int n = rVar(r);
450  rShortcut->order = (int*) omAlloc0((h+1)*sizeof(int));
451  rShortcut->block0 = (int*) omAlloc0((h+1)*sizeof(int));
452  rShortcut->block1 = (int*) omAlloc0((h+1)*sizeof(int));
453  rShortcut->wvhdl = (int**) omAlloc0((h+1)*sizeof(int*));
454  rShortcut->order[0] = ringorder_a;
455  rShortcut->block0[0] = 1;
456  rShortcut->block1[0] = n;
457  bool overflow;
458  rShortcut->wvhdl[0] = ZVectorToIntStar(w,overflow);
459  for (int i=1; i<=h; i++)
460  {
461  rShortcut->order[i] = order[i-1];
462  rShortcut->block0[i] = block0[i-1];
463  rShortcut->block1[i] = block1[i-1];
464  rShortcut->wvhdl[i] = wvhdl[i-1];
465  }
466 
467  // if valuation non-trivial, change coefficient ring to residue field
468  if (isValuationNonTrivial())
469  {
470  nKillChar(rShortcut->cf);
471  rShortcut->cf = nCopyCoeff(shortcutRing->cf);
472  }
473  rComplete(rShortcut);
474  rTest(rShortcut);
475 
476  // delete old ordering
477  omFree(order);
478  omFree(block0);
479  omFree(block1);
480  omFree(wvhdl);
481 
482  return rShortcut;
483 }
484 
485 std::pair<poly,int> tropicalStrategy::checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector &w) const
486 {
487  // quick check whether I already contains an ideal
488  int k = IDELEMS(I);
489  for (int i=0; i<k; i++)
490  {
491  poly g = I->m[i];
492  if (g!=NULL
493  && pNext(g)==NULL
494  && (isValuationTrivial() || n_IsOne(p_GetCoeff(g,r),r->cf)))
495  return std::pair<poly,int>(g,i);
496  }
497 
498  ring rShortcut;
499  ideal inIShortcut;
500  if (w.size()>0)
501  {
502  // if needed, prepend extra weight for homogeneity
503  // switch to residue field if valuation is non trivial
504  rShortcut = getShortcutRingPrependingWeight(r,w);
505 
506  // compute the initial ideal and map it into the constructed ring
507  // if switched to residue field, remove possibly 0 elements
508  ideal inI = initial(I,r,w);
509  inIShortcut = idInit(k);
510  nMapFunc intoShortcut = n_SetMap(r->cf,rShortcut->cf);
511  for (int i=0; i<k; i++)
512  inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,intoShortcut,NULL,0);
513  if (isValuationNonTrivial())
514  idSkipZeroes(inIShortcut);
515  id_Delete(&inI,r);
516  }
517  else
518  {
519  rShortcut = r;
520  inIShortcut = I;
521  }
522 
523  // check initial ideal for monomial and
524  // if it exsists, return a copy of the monomial in the input ring
525  poly p = checkForMonomialViaSuddenSaturation(inIShortcut,rShortcut);
526  poly monomial = NULL;
527  if (p!=NULL)
528  {
529  monomial=p_One(r);
530  for (int i=1; i<=rVar(r); i++)
531  p_SetExp(monomial,i,p_GetExp(p,i,rShortcut),r);
532  p_Setm(monomial,r);
533  p_Delete(&p,rShortcut);
534  }
535 
536 
537  if (w.size()>0)
538  {
539  // if needed, cleanup
540  id_Delete(&inIShortcut,rShortcut);
541  rDelete(rShortcut);
542  }
543  return std::pair<poly,int>(monomial,-1);
544 }
545 
547 {
548  ring rShortcut = rCopy0(r);
549  nKillChar(rShortcut->cf);
550  rShortcut->cf = nCopyCoeff(shortcutRing->cf);
551  rComplete(rShortcut);
552  rTest(rShortcut);
553  return rShortcut;
554 }
555 
556 ideal tropicalStrategy::computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
557 {
558  // if the valuation is trivial and the ring and ideal have not been extended,
559  // then it is sufficient to return the difference between the elements of inJ
560  // and their normal forms with respect to I and r
561  if (isValuationTrivial())
562  return witness(inJ,I,r);
563  // if the valuation is non-trivial and the ring and ideal have been extended,
564  // then we can make a shortcut through the residue field
565  else
566  {
567  assume(IDELEMS(inI)==IDELEMS(I));
568  int uni = findPositionOfUniformizingBinomial(I,r);
569  assume(uni>=0);
570  /**
571  * change ground ring into finite field
572  * and map the data into it
573  */
574  ring rShortcut = copyAndChangeCoefficientRing(r);
575 
576  int k = IDELEMS(inJ);
577  int l = IDELEMS(I);
578  ideal inJShortcut = idInit(k);
579  ideal inIShortcut = idInit(l);
580  nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
581  for (int i=0; i<k; i++)
582  inJShortcut->m[i] = p_PermPoly(inJ->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
583  for (int j=0; j<l; j++)
584  inIShortcut->m[j] = p_PermPoly(inI->m[j],NULL,r,rShortcut,takingResidues,NULL,0);
585  id_Test(inJShortcut,rShortcut);
586  id_Test(inIShortcut,rShortcut);
587 
588  /**
589  * Compute a division with remainder over the finite field
590  * and map the result back to r
591  */
592  matrix QShortcut = divisionDiscardingRemainder(inJShortcut,inIShortcut,rShortcut);
593  matrix Q = mpNew(l,k);
594  nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
595  for (int ij=k*l-1; ij>=0; ij--)
596  Q->m[ij] = p_PermPoly(QShortcut->m[ij],NULL,rShortcut,r,takingRepresentatives,NULL,0);
597 
598  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
599  number p = identity(uniformizingParameter,startingRing->cf,r->cf);
600 
601  /**
602  * Compute the normal forms
603  */
604  ideal J = idInit(k);
605  for (int j=0; j<k; j++)
606  {
607  poly q0 = p_Copy(inJ->m[j],r);
608  for (int i=0; i<l; i++)
609  {
610  poly qij = p_Copy(MATELEM(Q,i+1,j+1),r);
611  poly inIi = p_Copy(inI->m[i],r);
612  q0 = p_Add_q(q0,p_Neg(p_Mult_q(qij,inIi,r),r),r);
613  }
614  q0 = p_Div_nn(q0,p,r);
615  poly q0g0 = p_Mult_q(q0,p_Copy(I->m[uni],r),r);
616  // q0 = NULL;
617  poly qigi = NULL;
618  for (int i=0; i<l; i++)
619  {
620  poly qij = p_Copy(MATELEM(Q,i+1,j+1),r);
621  // poly inIi = p_Copy(I->m[i],r);
622  poly Ii = p_Copy(I->m[i],r);
623  qigi = p_Add_q(qigi,p_Mult_q(qij,Ii,r),r);
624  }
625  J->m[j] = p_Add_q(q0g0,qigi,r);
626  }
627 
628  id_Delete(&inIShortcut,rShortcut);
629  id_Delete(&inJShortcut,rShortcut);
630  mp_Delete(&QShortcut,rShortcut);
631  rDelete(rShortcut);
632  mp_Delete(&Q,r);
633  n_Delete(&p,r->cf);
634  return J;
635  }
636 }
637 
638 ideal tropicalStrategy::computeStdOfInitialIdeal(const ideal inI, const ring r) const
639 {
640  // if valuation trivial, then compute std as usual
641  if (isValuationTrivial())
642  return gfanlib_kStd_wrapper(inI,r);
643 
644  // if valuation non-trivial, then uniformizing parameter is in ideal
645  // so switch to residue field first and compute standard basis over the residue field
646  ring rShortcut = copyAndChangeCoefficientRing(r);
647  nMapFunc takingResidues = n_SetMap(r->cf,rShortcut->cf);
648  int k = IDELEMS(inI);
649  ideal inIShortcut = idInit(k);
650  for (int i=0; i<k; i++)
651  inIShortcut->m[i] = p_PermPoly(inI->m[i],NULL,r,rShortcut,takingResidues,NULL,0);
652  ideal inJShortcut = gfanlib_kStd_wrapper(inIShortcut,rShortcut);
653 
654  // and lift the result back to the ring with valuation
655  nMapFunc takingRepresentatives = n_SetMap(rShortcut->cf,r->cf);
656  k = IDELEMS(inJShortcut);
657  ideal inJ = idInit(k+1);
658  inJ->m[0] = p_One(r);
659  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
660  p_SetCoeff(inJ->m[0],identity(uniformizingParameter,startingRing->cf,r->cf),r);
661  for (int i=0; i<k; i++)
662  inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,rShortcut,r,takingRepresentatives,NULL,0);
663 
664  id_Delete(&inJShortcut,rShortcut);
665  id_Delete(&inIShortcut,rShortcut);
666  rDelete(rShortcut);
667  return inJ;
668 }
669 
670 ideal tropicalStrategy::computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
671 {
672  int k = IDELEMS(inJs);
673  ideal inJr = idInit(k);
674  nMapFunc identitysr = n_SetMap(s->cf,r->cf);
675  for (int i=0; i<k; i++)
676  inJr->m[i] = p_PermPoly(inJs->m[i],NULL,s,r,identitysr,NULL,0);
677 
678  ideal Jr = computeWitness(inJr,inIr,Ir,r);
679  nMapFunc identityrs = n_SetMap(r->cf,s->cf);
680  ideal Js = idInit(k);
681  for (int i=0; i<k; i++)
682  Js->m[i] = p_PermPoly(Jr->m[i],NULL,r,s,identityrs,NULL,0);
683  return Js;
684 }
685 
686 static void deleteOrdering(ring r)
687 {
688  if (r->order != NULL)
689  {
690  int i=rBlocks(r);
691  assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL);
692  /* delete order */
693  omFreeSize((ADDRESS)r->order,i*sizeof(int));
694  omFreeSize((ADDRESS)r->block0,i*sizeof(int));
695  omFreeSize((ADDRESS)r->block1,i*sizeof(int));
696  /* delete weights */
697  for (int j=0; j<i; j++)
698  if (r->wvhdl[j]!=NULL)
699  omFree(r->wvhdl[j]);
700  omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *));
701  }
702  else
703  assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL);
704  return;
705 }
706 
707 ring tropicalStrategy::copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
708 {
709  // copy shortcutRing and change to desired ordering
710  bool ok;
711  ring s = rCopy0(r);
712  int n = rVar(s);
713  deleteOrdering(s);
714  gfan::ZVector wAdjusted = adjustWeightForHomogeneity(w);
715  gfan::ZVector vAdjusted = adjustWeightUnderHomogeneity(v,wAdjusted);
716  s->order = (int*) omAlloc0(5*sizeof(int));
717  s->block0 = (int*) omAlloc0(5*sizeof(int));
718  s->block1 = (int*) omAlloc0(5*sizeof(int));
719  s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
720  s->order[0] = ringorder_a;
721  s->block0[0] = 1;
722  s->block1[0] = n;
723  s->wvhdl[0] = ZVectorToIntStar(wAdjusted,ok);
724  s->order[1] = ringorder_a;
725  s->block0[1] = 1;
726  s->block1[1] = n;
727  s->wvhdl[1] = ZVectorToIntStar(vAdjusted,ok);
728  s->order[2] = ringorder_lp;
729  s->block0[2] = 1;
730  s->block1[2] = n;
731  s->order[3] = ringorder_C;
732  rComplete(s);
733  rTest(s);
734 
735  return s;
736 }
737 
738 ring tropicalStrategy::copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
739 {
740  // copy shortcutRing and change to desired ordering
741  bool ok;
742  ring s = rCopy0(r);
743  int n = rVar(s);
744  deleteOrdering(s);
745  s->order = (int*) omAlloc0(5*sizeof(int));
746  s->block0 = (int*) omAlloc0(5*sizeof(int));
747  s->block1 = (int*) omAlloc0(5*sizeof(int));
748  s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
749  s->order[0] = ringorder_a;
750  s->block0[0] = 1;
751  s->block1[0] = n;
752  s->wvhdl[0] = ZVectorToIntStar(w,ok);
753  s->order[1] = ringorder_a;
754  s->block0[1] = 1;
755  s->block1[1] = n;
756  s->wvhdl[1] = ZVectorToIntStar(v,ok);
757  s->order[2] = ringorder_lp;
758  s->block0[2] = 1;
759  s->block1[2] = n;
760  s->order[3] = ringorder_C;
761  rComplete(s);
762  rTest(s);
763 
764  return s;
765 }
766 
767 std::pair<ideal,ring> tropicalStrategy::computeFlip(const ideal Ir, const ring r,
768  const gfan::ZVector &interiorPoint,
769  const gfan::ZVector &facetNormal) const
770 {
771  assume(isValuationTrivial() || interiorPoint[0].sign()<0);
773 
774  // get a generating system of the initial ideal
775  // and compute a standard basis with respect to adjacent ordering
776  ideal inIr = initial(Ir,r,interiorPoint);
777  ring sAdjusted = copyAndChangeOrderingWP(r,interiorPoint,facetNormal);
778  nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
779  int k = IDELEMS(Ir);
780  ideal inIsAdjusted = idInit(k);
781  for (int i=0; i<k; i++)
782  inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
783  ideal inJsAdjusted = computeStdOfInitialIdeal(inIsAdjusted,sAdjusted);
784 
785  // find witnesses of the new standard basis elements of the initial ideal
786  // with the help of the old standard basis of the ideal
787  k = IDELEMS(inJsAdjusted);
788  ideal inJr = idInit(k);
789  identity = n_SetMap(sAdjusted->cf,r->cf);
790  for (int i=0; i<k; i++)
791  inJr->m[i] = p_PermPoly(inJsAdjusted->m[i],NULL,sAdjusted,r,identity,NULL,0);
792 
793  ideal Jr = computeWitness(inJr,inIr,Ir,r);
794  ring s = copyAndChangeOrderingLS(r,interiorPoint,facetNormal);
795  identity = n_SetMap(r->cf,s->cf);
796  ideal Js = idInit(k);
797  for (int i=0; i<k; i++)
798  Js->m[i] = p_PermPoly(Jr->m[i],NULL,r,s,identity,NULL,0);
799 
800  // this->reduce(Jr,r);
801  // cleanup
802  id_Delete(&inIsAdjusted,sAdjusted);
803  id_Delete(&inJsAdjusted,sAdjusted);
804  rDelete(sAdjusted);
805  id_Delete(&inIr,r);
806  id_Delete(&Jr,r);
807  id_Delete(&inJr,r);
808 
810  return std::make_pair(Js,s);
811 }
812 
813 
814 bool tropicalStrategy::checkForUniformizingBinomial(const ideal I, const ring r) const
815 {
816  // if the valuation is trivial,
817  // then there is no special condition the first generator has to fullfill
818  if (isValuationTrivial())
819  return true;
820 
821  // if the valuation is non-trivial then checks if the first generator is p-t
822  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
823  poly p = p_One(r);
824  p_SetCoeff(p,identity(uniformizingParameter,startingRing->cf,r->cf),r);
825  poly t = p_One(r);
826  p_SetExp(t,1,1,r);
827  p_Setm(t,r);
828  poly pt = p_Add_q(p,p_Neg(t,r),r);
829 
830  for (int i=0; i<IDELEMS(I); i++)
831  {
832  if (p_EqualPolys(I->m[i],pt,r))
833  {
834  p_Delete(&pt,r);
835  return true;
836  }
837  }
838  p_Delete(&pt,r);
839  return false;
840 }
841 
842 int tropicalStrategy::findPositionOfUniformizingBinomial(const ideal I, const ring r) const
843 {
845 
846  // if the valuation is non-trivial then checks if the first generator is p-t
847  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
848  poly p = p_One(r);
849  p_SetCoeff(p,identity(uniformizingParameter,startingRing->cf,r->cf),r);
850  poly t = p_One(r);
851  p_SetExp(t,1,1,r);
852  p_Setm(t,r);
853  poly pt = p_Add_q(p,p_Neg(t,r),r);
854 
855  for (int i=0; i<IDELEMS(I); i++)
856  {
857  if (p_EqualPolys(I->m[i],pt,r))
858  {
859  p_Delete(&pt,r);
860  return i;
861  }
862  }
863  p_Delete(&pt,r);
864  return -1;
865 }
866 
867 bool tropicalStrategy::checkForUniformizingParameter(const ideal inI, const ring r) const
868 {
869  // if the valuation is trivial,
870  // then there is no special condition the first generator has to fullfill
871  if (isValuationTrivial())
872  return true;
873 
874  // if the valuation is non-trivial then checks if the first generator is p
875  if (inI->m[0]==NULL)
876  return false;
877  nMapFunc identity = n_SetMap(startingRing->cf,r->cf);
878  poly p = p_One(r);
879  p_SetCoeff(p,identity(uniformizingParameter,startingRing->cf,r->cf),r);
880 
881  for (int i=0; i<IDELEMS(inI); i++)
882  {
883  if (p_EqualPolys(inI->m[i],p,r))
884  {
885  p_Delete(&p,r);
886  return true;
887  }
888  }
889  p_Delete(&p,r);
890  return false;
891 }
892 
893 #ifndef NDEBUG
895  originalRing(NULL),
896  originalIdeal(NULL),
897  expectedDimension(NULL),
898  linealitySpace(gfan::ZCone()),
899  startingRing(NULL),
900  startingIdeal(NULL),
901  uniformizingParameter(NULL),
902  shortcutRing(NULL),
903  onlyLowerHalfSpace(false)
904 {
908 }
909 
910 tropicalStrategy tropicalStrategy::debugStrategy(const ideal startIdeal, number unifParameter, ring startRing)
911 {
912  tropicalStrategy debug;
913  debug.originalRing = rCopy(startRing);
914  debug.originalIdeal = id_Copy(startIdeal,startRing);
915  debug.startingRing = rCopy(startRing);
916  debug.startingIdeal = id_Copy(startIdeal,startRing);
917  debug.uniformizingParameter = n_Copy(unifParameter,startRing->cf);
918 
919  debug.shortcutRing = rCopy0(startRing);
920  nKillChar(debug.shortcutRing->cf);
921  debug.shortcutRing->cf = nInitChar(n_Zp,(void*)(long)IsPrime(n_Int(unifParameter,startRing->cf)));
922  rComplete(debug.shortcutRing);
923  rTest(debug.shortcutRing);
924 
925  debug.onlyLowerHalfSpace = true;
929 
930  return debug;
931 }
932 
934 {
935  leftv u = args;
936  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
937  {
938  leftv v = u->next;
939  if ((v!=NULL) && (v->Typ()==IDEAL_CMD))
940  {
941  leftv w = v->next;
942  if ((w!=NULL) && (w->Typ()==IDEAL_CMD))
943  {
944  leftv x = w->next;
945  if ((x!=NULL) && (x->Typ()==NUMBER_CMD))
946  {
947  omUpdateInfo();
948  Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
949 
950  ideal inJ = (ideal) u->CopyD();
951  ideal inI = (ideal) v->CopyD();
952  ideal I = (ideal) w->CopyD();
953  number p = (number) x->CopyD();
955  ideal J = debug.computeWitness(inJ,inI,I,currRing);
956  id_Delete(&inJ,currRing);
957  id_Delete(&inI,currRing);
958  id_Delete(&I,currRing);
959  n_Delete(&p,currRing->cf);
960  res->rtyp = IDEAL_CMD;
961  res->data = (char*) J;
962  return FALSE;
963  }
964  }
965  }
966  }
967  return TRUE;
968 }
969 
971 {
972  leftv u = args;
973  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
974  {
975  leftv v = u->next;
976  if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
977  {
978  leftv w = v->next;
979  if ((w!=NULL) && (w->Typ()==BIGINTMAT_CMD))
980  {
981  leftv x = w->next;
982  if ((x!=NULL) && (x->Typ()==BIGINTMAT_CMD))
983  {
984  omUpdateInfo();
985  Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);
986 
987  ideal I = (ideal) u->CopyD();
988  number p = (number) v->CopyD();
989  bigintmat* interiorPoint0 = (bigintmat*) w->CopyD();
990  bigintmat* facetNormal0 = (bigintmat*) x->CopyD();
992 
993  gfan::ZVector* interiorPoint = bigintmatToZVector(interiorPoint0);
994  gfan::ZVector* facetNormal = bigintmatToZVector(facetNormal0);
995  std::pair<ideal,ring> Js = debug.computeFlip(I,currRing,*interiorPoint,*facetNormal);
996  ideal J = Js.first;
997  ring s = Js.second;
998 
999  id_Delete(&J,s);
1000  rDelete(s);
1001 
1002  id_Delete(&I,currRing);
1003  n_Delete(&p,currRing->cf);
1004  delete interiorPoint0;
1005  delete facetNormal0;
1006  delete interiorPoint;
1007  delete facetNormal;
1008 
1009  res->rtyp = NONE;
1010  res->data = NULL;
1011  return FALSE;
1012  }
1013  }
1014  }
1015  }
1016  WerrorS("computeFlipDebug: unexpected parameters");
1017  return TRUE;
1018 }
1019 #endif
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:39
implementation of the class tropicalStrategy
ring getOriginalRing() const
returns the polynomial ring over the field with valuation
const CanonicalForm int s
Definition: facAbsFact.cc:55
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.
Definition: witness.cc:9
ideal getOriginalIdeal() const
returns the input ideal over the field with valuation
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
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...
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
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.
Definition: coeffs.h:519
gfan::ZCone homogeneitySpace(ideal I, ring r)
Definition: tropical.cc:19
bool isValuationNonTrivial() const
gfan::ZVector nonvalued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &)
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
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...
#define FALSE
Definition: auxiliary.h:97
bool isOrderingLocalInT(const ring r)
return P p
Definition: myNF.cc:203
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:472
Matrices of numbers.
Definition: bigintmat.h:51
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...
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...
#define id_Test(A, lR)
Definition: simpleideals.h:80
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
Definition: coeffs.h:542
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
{p < 2^31}
Definition: coeffs.h:30
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1475
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 ...
#define TRUE
Definition: auxiliary.h:101
void * ADDRESS
Definition: auxiliary.h:118
static ideal constructStartingIdeal(ideal originalIdeal, ring originalRing, number uniformizingParameter, ring startingRing)
g
Definition: cfModGcd.cc:4031
bool onlyLowerHalfSpace
true if valuation non-trivial, false otherwise
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
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)
int Typ()
Definition: subexpr.cc:979
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
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
Definition: p_polys.h:804
ideal startingIdeal
preimage of the input ideal under the map that sends t to the uniformizing parameter ...
void * data
Definition: subexpr.h:90
~tropicalStrategy()
destructor
poly res
Definition: myNF.cc:322
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.
Definition: initial.cc:32
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
poly * m
Definition: matpol.h:19
static int rBlocks(ring r)
Definition: ring.h:556
const ring r
Definition: syzextra.cc:208
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)
Definition: p_polys.cc:3939
BOOLEAN linealitySpace(leftv res, leftv args)
Definition: bbcone.cc:881
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 ...
Definition: coeffs.h:551
poly p_One(const ring r)
Definition: p_polys.cc:1313
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...
Definition: ring.cc:3435
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:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:5
#define omFree(addr)
Definition: omAllocDecl.h:261
omInfo_t om_Info
Definition: omStats.c:13
#define assume(x)
Definition: mod2.h:403
static void deleteOrdering(ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
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)
Definition: hdegree.cc:72
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)
Definition: coeffs.h:742
#define rTest(r)
Definition: ring.h:775
return false
Definition: cfModGcd.cc:84
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
Definition: coeffs.h:43
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...
int dim(ideal I, ring r)
ring copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
int IsPrime(int p)
Definition: prime.cc:61
#define IDELEMS(i)
Definition: simpleideals.h:24
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:785
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
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)
Definition: p_polys.cc:4321
gfan::ZVector valued_adjustWeightUnderHomogeneity(const gfan::ZVector &e, const gfan::ZVector &w)
leftv next
Definition: subexpr.h:88
void rChangeCurrRing(ring r)
Definition: polys.cc:12
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:433
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
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
Definition: facBivar.h:37
number uniformizingParameter
uniformizing parameter in the valuation ring
ring rCopy(ring r)
Definition: ring.cc:1619
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
Definition: p_polys.h:483
ring startingRing
polynomial ring over the valuation ring extended by one extra variable t
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
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.
Definition: witness.cc:34
ring copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:455
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
bool checkForUniformizingBinomial(const ideal I, const ring r) const
if valuation non-trivial, checks whether the generating system contains p-t otherwise returns true ...
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
void omUpdateInfo()
Definition: omStats.c:24
static BOOLEAN rField_is_Ring_Z(const ring r)
Definition: ring.h:474
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)
returns the ideals of initial terms
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:169
int rtyp
Definition: subexpr.h:93
Variable x
Definition: cfModGcd.cc:4023
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:459
ring originalRing
polynomial ring over a field with valuation
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:216
tropicalStrategy & operator=(const tropicalStrategy &currentStrategy)
assignment operator
gfan::ZCone linealitySpace
the homogeneity space of the Grobner fan
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:490
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020
static int sign(int x)
Definition: ring.cc:3412
void * CopyD(int t)
Definition: subexpr.cc:679
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
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 ...
#define MATELEM(mat, i, j)
Definition: matpol.h:29
bool isValuationTrivial() const
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:329
#define omStrDup(s)
Definition: omAllocDecl.h:263