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