My Project  UNKNOWN_GIT_VERSION
Functions | Variables
startingCone.cc File Reference
#include "callgfanlib_conversion.h"
#include "singularWishlist.h"
#include "tropicalDebug.h"
#include "containsMonomial.h"
#include "tropical.h"
#include "initial.h"
#include "lift.h"
#include "groebnerCone.h"
#include "tropicalStrategy.h"
#include "tropicalCurves.h"
#include "bbcone.h"
#include "tropicalVarietyOfPolynomials.h"
#include "tropicalVariety.h"
#include "std_wrapper.h"

Go to the source code of this file.

Functions

groebnerCone groebnerStartingCone (const tropicalStrategy &currentStrategy)
 
std::pair< gfan::ZVector, groebnerConetropicalStartingPoint (const ideal I, const ring r, const tropicalStrategy &currentStrategy)
 Computes a starting point outside the lineatliy space by traversing the Groebner fan, checking each cone whether it contains a ray in the tropical variety. More...
 
std::pair< gfan::ZVector, groebnerConetropicalStartingDataViaGroebnerFan (const ideal I, const ring r, const tropicalStrategy &currentStrategy)
 Computes a starting point outside the lineatliy space by traversing the Groebner fan, checking each cone whether it contains a ray in the tropical variety. More...
 
BOOLEAN positiveTropicalStartingPoint (leftv res, leftv args)
 
BOOLEAN nonNegativeTropicalStartingPoint (leftv res, leftv args)
 
BOOLEAN negativeTropicalStartingPoint (leftv res, leftv args)
 
BOOLEAN nonPositiveTropicalStartingPoint (leftv res, leftv args)
 
BOOLEAN tropicalStartingPoint (leftv res, leftv args)
 
static gfan::ZCone linealitySpaceOfGroebnerFan (const ideal I, const ring r)
 
ring createTraversalStartingRing (const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy &currentStrategy)
 
groebnerCone tropicalStartingCone (const tropicalStrategy &currentStrategy)
 
BOOLEAN tropicalStartingCone (leftv res, leftv args)
 

Variables

gfan::ZMatrix tropicalStartingPoints
 

Function Documentation

◆ createTraversalStartingRing()

ring createTraversalStartingRing ( const ring  s,
const gfan::ZMatrix &  startingPoints,
const tropicalStrategy currentStrategy 
)

Definition at line 338 of file startingCone.cc.

340 {
341  // copy r except qideal (which should be 0) and ordering
342  ring s0 = rCopy0(s,FALSE,FALSE);
343  int n = rVar(s);
344  bool ok;
345 
346  // adjust weight and create new ordering
347  int h = startingPoints.getHeight();
348  s0->order = (rRingOrder_t*) omAlloc0((h+3)*sizeof(rRingOrder_t));
349  s0->block0 = (int*) omAlloc0((h+3)*sizeof(int));
350  s0->block1 = (int*) omAlloc0((h+3)*sizeof(int));
351  s0->wvhdl = (int**) omAlloc0((h+3)*sizeof(int**));
352  for (int i=0; i<h; i++)
353  {
354  s0->order[i] = ringorder_a;
355  s0->block0[i] = 1;
356  s0->block1[i] = n;
357  s0->wvhdl[i] = ZVectorToIntStar(startingPoints[i],ok);
358  }
359  s0->order[h] = ringorder_lp;
360  s0->block0[h] = 1;
361  s0->block1[h] = n;
362  s0->order[h+1] = ringorder_C;
363 
364  rComplete(s0);
365  rTest(s0);
366 
367  return s0;

◆ groebnerStartingCone()

groebnerCone groebnerStartingCone ( const tropicalStrategy currentStrategy)

Definition at line 21 of file startingCone.cc.

22 {
23  groebnerCone sigma(currentStrategy.getStartingIdeal(), currentStrategy.getStartingRing(), currentStrategy);
24  return sigma;
25 }

◆ linealitySpaceOfGroebnerFan()

static gfan::ZCone linealitySpaceOfGroebnerFan ( const ideal  I,
const ring  r 
)
static

Definition at line 313 of file startingCone.cc.

315 {
316  int n = rVar(r);
317  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
318  int* expv = (int*) omAlloc((n+1)*sizeof(int));
319  int k = IDELEMS(I);
320  for (int i=0; i<k; i++)
321  {
322  poly g = I->m[i];
323  if (g)
324  {
325  p_GetExpV(g,expv,r);
326  gfan::ZVector leadexp = intStar2ZVector(n,expv);
327  for (pIter(g); g; pIter(g))
328  {
329  p_GetExpV(g,expv,r);
330  equations.appendRow(leadexp-intStar2ZVector(n,expv));
331  }
332  }
333  }
334  omFreeSize(expv,(n+1)*sizeof(int));
335  return gfan::ZCone(gfan::ZMatrix(0,n),equations);

◆ negativeTropicalStartingPoint()

BOOLEAN negativeTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 191 of file startingCone.cc.

192 {
193  leftv u = args;
194  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
195  {
196  ideal I = (ideal) u->Data();
197  if ((I->m[0]!=NULL) && (idElem(I)==1))
198  {
199  tropicalStrategy currentStrategy(I,currRing);
200  poly g = I->m[0];
201  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
202  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
203  {
204  gfan::ZMatrix ray = zc->extremeRays();
205  for (int i=0; i<ray.getHeight(); i++)
206  {
207  gfan::ZVector negatedRay = gfan::Integer(-1)*ray[i].toVector();
208  if (negatedRay.isPositive())
209  {
210  res->rtyp = BIGINTMAT_CMD;
211  res->data = (void*) zVectorToBigintmat(ray[i].toVector());
212  return FALSE;
213  }
214  }
215  }
216  res->rtyp = BIGINTMAT_CMD;
217  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
218  return FALSE;
219  }
220  WerrorS("negativeTropicalStartingPoint: ideal not principal");
221  return TRUE;
222  }
223  WerrorS("negativeTropicalStartingPoint: unexpected parameters");
224  return TRUE;
225 }

◆ nonNegativeTropicalStartingPoint()

BOOLEAN nonNegativeTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 156 of file startingCone.cc.

157 {
158  leftv u = args;
159  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
160  {
161  ideal I = (ideal) u->Data();
162  if ((I->m[0]!=NULL) && (idElem(I)==1))
163  {
164  tropicalStrategy currentStrategy(I,currRing);
165  poly g = I->m[0];
166  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
167  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
168  {
169  gfan::ZMatrix ray = zc->extremeRays();
170  for (int i=0; i<ray.getHeight(); i++)
171  {
172  if (ray[i].toVector().isNonNegative())
173  {
174  res->rtyp = BIGINTMAT_CMD;
175  res->data = (void*) zVectorToBigintmat(ray[i].toVector());
176  return FALSE;
177  }
178  }
179  }
180  res->rtyp = BIGINTMAT_CMD;
181  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
182  return FALSE;
183  }
184  WerrorS("nonNegativeTropicalStartingPoint: ideal not principal");
185  return TRUE;
186  }
187  WerrorS("nonNegativeTropicalStartingPoint: unexpected parameters");
188  return TRUE;
189 }

◆ nonPositiveTropicalStartingPoint()

BOOLEAN nonPositiveTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 227 of file startingCone.cc.

228 {
229  leftv u = args;
230  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
231  {
232  ideal I = (ideal) u->Data();
233  if ((I->m[0]!=NULL) && (idElem(I)==1))
234  {
235  tropicalStrategy currentStrategy(I,currRing);
236  poly g = I->m[0];
237  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
238  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
239  {
240  gfan::ZMatrix ray = zc->extremeRays();
241  for (int i=0; i<ray.getHeight(); i++)
242  {
243  gfan::ZVector negatedRay = gfan::Integer(-1)*ray[i].toVector();
244  if (negatedRay.isNonNegative())
245  {
246  res->rtyp = BIGINTMAT_CMD;
247  res->data = (void*) zVectorToBigintmat(ray[i]);
248  return FALSE;
249  }
250  }
251  }
252  res->rtyp = BIGINTMAT_CMD;
253  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
254  return FALSE;
255  }
256  WerrorS("nonPositiveTropicalStartingPoint: ideal not principal");
257  return TRUE;
258  }
259  WerrorS("nonPositiveTropicalStartingPoint: unexpected parameters");
260  return TRUE;
261 }

◆ positiveTropicalStartingPoint()

BOOLEAN positiveTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 121 of file startingCone.cc.

122 {
123  leftv u = args;
124  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
125  {
126  ideal I = (ideal) u->Data();
127  if ((I->m[0]!=NULL) && (idElem(I)==1))
128  {
129  tropicalStrategy currentStrategy(I,currRing);
130  poly g = I->m[0];
131  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
132  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
133  {
134  gfan::ZMatrix ray = zc->extremeRays();
135  for (int i=0; i<ray.getHeight(); i++)
136  {
137  if (ray[i].toVector().isPositive())
138  {
139  res->rtyp = BIGINTMAT_CMD;
140  res->data = (void*) zVectorToBigintmat(ray[i].toVector());
141  return FALSE;
142  }
143  }
144  }
145  res->rtyp = BIGINTMAT_CMD;
146  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
147  return FALSE;
148  }
149  WerrorS("positiveTropicalStartingPoint: ideal not principal");
150  return TRUE;
151  }
152  WerrorS("positiveTropicalStartingPoint: unexpected parameters");
153  return TRUE;
154 }

◆ tropicalStartingCone() [1/2]

groebnerCone tropicalStartingCone ( const tropicalStrategy currentStrategy)

Definition at line 372 of file startingCone.cc.

375 {
376  ring r = currentStrategy.getStartingRing();
377  ideal I = currentStrategy.getStartingIdeal();
378  currentStrategy.reduce(I,r);
379  if (currentStrategy.isValuationTrivial())
380  {
381  // copy the data, so that it be deleted when passed to the loop
382  // s <- r
383  // inI <- I
384  ring s = rCopy(r);
385  int k = IDELEMS(I); ideal inI = idInit(k);
386  nMapFunc identityMap = n_SetMap(r->cf,s->cf);
387  for (int i=0; i<k; i++)
388  {
389  if(I->m[i]!=NULL)
390  {
391  inI->m[i] = p_PermPoly(I->m[i],NULL,r,s,identityMap,NULL,0);
392  }
393  }
394 
395  // repeatedly computes a point in the tropical variety outside the lineality space,
396  // take the initial ideal with respect to it
397  // and check whether the dimension of its homogeneity space
398  // equals the dimension of the tropical variety
399  gfan::ZCone zc = linealitySpaceOfGroebnerFan(inI,s);
400  groebnerCone ambientMaximalCone;
401  if (zc.dimension()>=currentStrategy.getExpectedDimension())
402  {
403  // check whether the lineality space is contained in the tropical variety
404  // i.e. whether the ideal does not contain a monomial
405  poly mon = checkForMonomialViaSuddenSaturation(I,r);
406  if (mon)
407  {
408  groebnerCone emptyCone = groebnerCone();
409  p_Delete(&mon,r);
410  id_Delete(&inI,s);
411  return emptyCone;
412  }
413  groebnerCone startingCone(inI,inI,s,currentStrategy);
414  id_Delete(&inI,s);
415  return startingCone;
416  }
417  while (zc.dimension()<currentStrategy.getExpectedDimension())
418  {
419  // compute a point in the tropical variety outside the lineality space
420  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(inI,s,currentStrategy);
421  gfan::ZVector startingPoint = startingData.first;
422  tropicalStartingPoints.appendRow(startingPoint);
423  ambientMaximalCone = groebnerCone(startingData.second);
424 
425  id_Delete(&inI,s); rDelete(s);
426  inI = ambientMaximalCone.getPolynomialIdeal();
427  s = ambientMaximalCone.getPolynomialRing();
428 
429  // compute the initial ideal with respect to the weight
430  inI = initial(inI,s,startingPoint);
431  zc = linealitySpaceOfGroebnerFan(inI,s);
432  }
433 
434  // once the dimension of the homogeneity space equals that of the tropical variety
435  // we know that we have an initial ideal with respect to a weight
436  // in the relative interior of a maximal cone in the tropical variety
437  // from this we can read of the inequalities and equations
438 
439  ring s0 = createTraversalStartingRing(s,tropicalStartingPoints,currentStrategy);
440  nMapFunc identity = n_SetMap(s->cf,s0->cf);
441  k = IDELEMS(inI);
442  ideal inI0 = idInit(k);
443  for (int i=0; i<k; i++)
444  inI0->m[i] = p_PermPoly(inI->m[i],NULL,s,s0,identity,NULL,0);
445 
446  identity = n_SetMap(r->cf,s0->cf);
447  k = IDELEMS(I);
448  ideal I0 = idInit(k);
449  for (int i=0; i<k; i++)
450  I0->m[i] = p_PermPoly(I->m[i],NULL,r,s0,identity,NULL,0);
451 
452 
453  // but before doing so, we must lift the generating set of inI
454  // to a generating set of I
455  // ideal J0 = lift(I,r,inI0,s0); // todo: use computeLift from tropicalStrategy
456  ideal J0 = gfanlib_kStd_wrapper(I0,s0);
457  assume(areIdealsEqual(J0,s0,I,r));
458  id_Delete(&I0,s0);
459  groebnerCone startingCone(J0,inI0,s0,currentStrategy);
460  id_Delete(&J0,s0);
461  id_Delete(&inI0,s0);
462  rDelete(s0);
463 
464  // assume(checkContainmentInTropicalVariety(startingCone));
465  return startingCone;
466  }
467  else
468  {
469  // copy the data, so that it be deleted when passed to the loop
470  // s <- r
471  // inJ <- I
472  ring s = rCopy(r);
473  int k = IDELEMS(I); ideal inJ = idInit(k);
474  nMapFunc identityMap = n_SetMap(r->cf,s->cf);
475  for (int i=0; i<k; i++)
476  {
477  if(I->m[i]!=NULL)
478  {
479  inJ->m[i] = p_PermPoly(I->m[i],NULL,r,s,identityMap,NULL,0);
480  }
481  }
482 
483  // and check whether the dimension of its homogeneity space
484  // equals the dimension of the tropical variety
485  gfan::ZCone zc = linealitySpaceOfGroebnerFan(inJ,s);
486  if (zc.dimension()>=currentStrategy.getExpectedDimension())
487  { // this shouldn't happen as trivial cases should be caught beforehand
488  // this is the case that the tropical variety consists soely out of the lineality space
489  poly mon = checkForMonomialViaSuddenSaturation(I,r);
490  if (mon)
491  {
492  groebnerCone emptyCone = groebnerCone();
493  p_Delete(&mon,r);
494  return emptyCone;
495  }
496  groebnerCone startingCone(I,inJ,s,currentStrategy);
497  id_Delete(&inJ,s);
498  rDelete(s);
499  return startingCone;
500  }
501 
502  // compute a point in the tropical variety outside the lineality space
503  // compute the initial ideal with respect to the weight
504  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(inJ,s,currentStrategy);
505  gfan::ZVector startingPoint = startingData.first;
506  tropicalStartingPoints.appendRow(startingPoint);
507  groebnerCone ambientMaximalCone = groebnerCone(startingData.second);
508  id_Delete(&inJ,s); rDelete(s);
509  inJ = ambientMaximalCone.getPolynomialIdeal();
510  s = ambientMaximalCone.getPolynomialRing();
511  inJ = initial(inJ,s,startingPoint);
512  ideal inI = initial(I,r,startingPoint);
513  zc = linealitySpaceOfGroebnerFan(inJ,s);
514 
515  // and check whether the dimension of its homogeneity space
516  // equals the dimension of the tropical variety
517  if (zc.dimension()==currentStrategy.getExpectedDimension())
518  { // this case shouldn't happen as trivial cases should be caught beforehand
519  // this is the case that the tropical variety has a one-codimensional lineality space
520  ideal J = lift(I,r,inJ,s); // todo: use computeLift from tropicalStrategy
521  groebnerCone startingCone(J,inJ,s,currentStrategy);
522  id_Delete(&inJ,s);
523  id_Delete(&J,s);
524  return startingCone;
525  }
526 
527  // from this point on, inJ contains the uniformizing parameter,
528  // hence it contains a monomial if and only if its residue over the residue field does.
529  // so we will switch to the residue field
530  ring rShortcut = rCopy0(r);
531  nKillChar(rShortcut->cf);
532  rShortcut->cf = nCopyCoeff((currentStrategy.getShortcutRing())->cf);
533  rComplete(rShortcut);
534  rTest(rShortcut);
535  k = IDELEMS(inJ);
536  ideal inJShortcut = idInit(k);
537  nMapFunc takingResidues = n_SetMap(s->cf,rShortcut->cf);
538  for (int i=0; i<k; i++)
539  {
540  if(inJ->m[i]!=NULL)
541  {
542  inJShortcut->m[i] = p_PermPoly(inJ->m[i],NULL,s,rShortcut,takingResidues,NULL,0);
543  }
544  }
545  idSkipZeroes(inJShortcut);
546  id_Delete(&inJ,s);
547 
548  // we are interested in a maximal cone of the tropical variety of inJShortcut
549  // this basically equivalent to the case without valuation (or constant coefficient case)
550  // except that our ideal is still only homogeneous in the later variables,
551  // hence we set the optional parameter completelyHomogeneous as 'false'
552  tropicalStrategy shortcutStrategy(inJShortcut,rShortcut,false);
553  groebnerCone startingConeShortcut = tropicalStartingCone(shortcutStrategy);
554  id_Delete(&inJShortcut,rShortcut); rDelete(rShortcut);
555 
556  // now we need to obtain the initial of the residue of inJ
557  // with respect to a weight in the tropical cone,
558  // and obtain the initial of inJ with respect to the same weight
559  ring sShortcut = startingConeShortcut.getPolynomialRing();
560  inJShortcut = startingConeShortcut.getPolynomialIdeal();
561  gfan::ZCone zd = startingConeShortcut.getPolyhedralCone();
562  gfan::ZVector interiorPoint = startingConeShortcut.getInteriorPoint();
563  inJShortcut = initial(inJShortcut,sShortcut,interiorPoint);
564  inI = initial(inI,r,interiorPoint);
565 
566  s = rCopy0(sShortcut); // s will be a ring over the valuation ring
567  nKillChar(s->cf); // with the same ordering as sShortcut
568  s->cf = nCopyCoeff(r->cf);
569  rComplete(s);
570  rTest(s);
571 
572  k = IDELEMS(inJShortcut); // inJ will be overwritten with initial of inJ
573  inJ = idInit(k+1);
574  inJ->m[0] = p_One(s); // with respect to that weight
575  identityMap = n_SetMap(r->cf,s->cf); // first element will obviously be p
576  p_SetCoeff(inJ->m[0],identityMap(currentStrategy.getUniformizingParameter(),r->cf,s->cf),s);
577  nMapFunc findingRepresentatives = n_SetMap(sShortcut->cf,s->cf);
578  for (int i=0; i<k; i++) // and then come the rest
579  {
580  if(inJShortcut->m[i]!=NULL)
581  {
582  inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,sShortcut,s,findingRepresentatives,NULL,0);
583  }
584  }
585 
586  ring s0 = createTraversalStartingRing(s,tropicalStartingPoints,currentStrategy);
587  nMapFunc identity = n_SetMap(s->cf,s0->cf);
588  k = IDELEMS(inJ);
589  ideal inI0 = idInit(k);
590  for (int i=0; i<k; i++)
591  inI0->m[i] = p_PermPoly(inJ->m[i],NULL,s,s0,identity,NULL,0);
592 
593  identity = n_SetMap(r->cf,s0->cf);
594  k = IDELEMS(I);
595  ideal I0 = idInit(k);
596  for (int i=0; i<k; i++)
597  I0->m[i] = p_PermPoly(I->m[i],NULL,r,s0,identity,NULL,0);
598  ideal J0 = gfanlib_kStd_wrapper(I0,s0);
599  groebnerCone startingCone(J0,inI0,s0,currentStrategy);
600 
601  // ideal J = currentStrategy.computeLift(inJ,s,inI,I,r);
602  // currentStrategy.reduce(J,s);
603  // groebnerCone startingCone(J,inJ,s,currentStrategy);
604  id_Delete(&inJ,s);
605  // id_Delete(&J,s);
606  rDelete(s);
607  id_Delete(&inI,r);
608 
609  // assume(checkContainmentInTropicalVariety(startingCone));
610  return startingCone;

◆ tropicalStartingCone() [2/2]

BOOLEAN tropicalStartingCone ( leftv  res,
leftv  args 
)

Definition at line 612 of file startingCone.cc.

615 {
616  leftv u = args;
617  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
618  {
619  ideal I = (ideal) u->CopyD();
620  leftv v = u->next;
621  if ((v != NULL) && (v->Typ() == NUMBER_CMD))
622  {
623  number p = (number) v->Data();
624  leftv w = v->next;
625  if (w==NULL)
626  {
627  tropicalStrategy currentStrategy(I,p,currRing);
628  groebnerCone sigma = tropicalStartingCone(currentStrategy);
629  gfan::ZCone* startingCone = new gfan::ZCone(sigma.getPolyhedralCone());
630  res->rtyp = coneID;
631  res->data = (char*) startingCone;
632  return FALSE;
633  }
634  }
635  else
636  {
637  if (v==NULL)
638  {
639  tropicalStrategy currentStrategy(I,currRing);
640  groebnerCone sigma = tropicalStartingCone(currentStrategy);
641  res->rtyp = coneID;
642  res->data = (char*) new gfan::ZCone(sigma.getPolyhedralCone());
643  return FALSE;
644  }
645  }
646  }
647  WerrorS("tropicalStartingCone: unexpected parameters");

◆ tropicalStartingDataViaGroebnerFan()

std::pair<gfan::ZVector,groebnerCone> tropicalStartingDataViaGroebnerFan ( const ideal  I,
const ring  r,
const tropicalStrategy currentStrategy 
)

Computes a starting point outside the lineatliy space by traversing the Groebner fan, checking each cone whether it contains a ray in the tropical variety.

Returns a point in the tropical variety and a maximal Groebner cone containing the point.

Definition at line 80 of file startingCone.cc.

81 {
82  // start by computing a maximal Groebner cone and
83  // check whether one of its rays lies in the tropical variety
84  const groebnerCone sigma(I,r,currentStrategy);
85  gfan::ZVector startingPoint = sigma.tropicalPoint();
86  if (startingPoint.size() > 0)
87  return std::make_pair(startingPoint,sigma);
88 
89  // if not, traverse the groebnerFan and until such a cone is found
90  // and return the maximal cone together with a point in its ray
92  groebnerCones workingList;
93  workingList.insert(sigma);
94  while (!workingList.empty())
95  {
96  const groebnerCone sigma = *(workingList.begin());
97  groebnerCones neighbours = sigma.groebnerNeighbours();
98  for (groebnerCones::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++)
99  {
100  if (groebnerFan.count(*tau) == 0)
101  {
102  if (workingList.count(*tau) == 0)
103  {
104  startingPoint = tau->tropicalPoint();
105  if (startingPoint.size() > 0)
106  return std::make_pair(startingPoint,*tau);
107  }
108  workingList.insert(*tau);
109  }
110  }
111  groebnerFan.insert(sigma);
112  workingList.erase(sigma);
113  }
114 
115  // return some trivial output, if such a cone cannot be found
116  gfan::ZVector emptyVector = gfan::ZVector(0);
117  groebnerCone emptyCone = groebnerCone();
118  return std::pair<gfan::ZVector,groebnerCone>(emptyVector,emptyCone);
119 }

◆ tropicalStartingPoint() [1/2]

std::pair<gfan::ZVector,groebnerCone> tropicalStartingPoint ( const ideal  I,
const ring  r,
const tropicalStrategy currentStrategy 
)

Computes a starting point outside the lineatliy space by traversing the Groebner fan, checking each cone whether it contains a ray in the tropical variety.

Returns a point in the tropical variety and a maximal Groebner cone containing the point.

Definition at line 33 of file startingCone.cc.

34 {
35  // start by computing a maximal Groebner cone and
36  // check whether one of its rays lies in the tropical variety
37  const groebnerCone sigma(I,r,currentStrategy);
38  gfan::ZVector startingPoint = sigma.tropicalPoint();
39  if (startingPoint.size() > 0)
40  return std::make_pair(startingPoint,sigma);
41 
42  // if not, traverse the groebnerFan and until such a cone is found
43  // and return the maximal cone together with a point in its ray
45  groebnerCones workingList;
46  workingList.insert(sigma);
47  while (!workingList.empty())
48  {
49  const groebnerCone sigma = *(workingList.begin());
50  groebnerCones neighbours = sigma.groebnerNeighbours();
51  for (groebnerCones::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++)
52  {
53  if (groebnerFan.count(*tau) == 0)
54  {
55  if (workingList.count(*tau) == 0)
56  {
57  startingPoint = tau->tropicalPoint();
58  if (startingPoint.size() > 0)
59  return std::make_pair(startingPoint,*tau);
60  }
61  workingList.insert(*tau);
62  }
63  }
64  groebnerFan.insert(sigma);
65  workingList.erase(sigma);
66  }
67 
68  // return some trivial output, if such a cone cannot be found
69  gfan::ZVector emptyVector = gfan::ZVector(0);
70  groebnerCone emptyCone = groebnerCone();
71  return std::pair<gfan::ZVector,groebnerCone>(emptyVector,emptyCone);
72 }

◆ tropicalStartingPoint() [2/2]

BOOLEAN tropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 263 of file startingCone.cc.

264 {
265  leftv u = args;
266  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
267  {
268  ideal I = (ideal) u->Data();
269  tropicalStrategy currentStrategy(I,currRing);
270  if ((I->m[0]!=NULL) && (idElem(I)==1))
271  {
272  poly g = I->m[0];
273  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
274  if (Tg.empty())
275  {
276  res->rtyp = BIGINTMAT_CMD;
277  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
278  return FALSE;
279  }
280  gfan::ZCone C = *(Tg.begin());
281  gfan::ZMatrix rays = C.extremeRays();
282  if (rays.getHeight()==0)
283  {
284  gfan::ZMatrix lin = C.generatorsOfLinealitySpace();
285  res->rtyp = BIGINTMAT_CMD;
286  res->data = (void*) zVectorToBigintmat(lin[0]);
287  return FALSE;
288  }
289  res->rtyp = BIGINTMAT_CMD;
290  res->data = (void*) zVectorToBigintmat(rays[0]);
291  return FALSE;
292  }
293  gfan::ZCone C0 = currentStrategy.getHomogeneitySpace();
294  if (C0.dimension()==currentStrategy.getExpectedDimension())
295  {
296  gfan::ZMatrix lin = C0.generatorsOfLinealitySpace();
297  res->rtyp = BIGINTMAT_CMD;
298  res->data = (void*) zVectorToBigintmat(lin[0]);
299  return FALSE;
300  }
301  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(I,currRing,currentStrategy);
302  gfan::ZVector startingPoint = startingData.first;
303  res->rtyp = BIGINTMAT_CMD;
304  res->data = (void*) zVectorToBigintmat(startingPoint);
305  return FALSE;
306  }
307  WerrorS("tropicalStartingPoint: unexpected parameters");
308  return TRUE;
309 }

Variable Documentation

◆ tropicalStartingPoints

gfan::ZMatrix tropicalStartingPoints

Definition at line 18 of file startingCone.cc.

FALSE
#define FALSE
Definition: auxiliary.h:94
tropicalStrategy::isValuationTrivial
bool isValuationTrivial() const
Definition: tropicalStrategy.h:144
idElem
int idElem(const ideal F)
count non-zero elements
Definition: simpleideals.cc:209
sleftv::Data
void * Data()
Definition: subexpr.cc:1181
k
int k
Definition: cfEzgcd.cc:92
NUMBER_CMD
Definition: grammar.cc:288
groebnerCones
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:23
lift
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:25
tropicalStrategy::reduce
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 ...
Definition: tropicalStrategy.cc:414
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
tropicalStartingCone
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
Definition: startingCone.cc:372
g
g
Definition: cfModGcd.cc:4031
tropicalStrategy::getExpectedDimension
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
Definition: tropicalStrategy.h:199
zVectorToBigintmat
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
Definition: callgfanlib_conversion.cc:21
BIGINTMAT_CMD
Definition: grammar.cc:278
rTest
#define rTest(r)
Definition: ring.h:775
initial
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:30
Variable::next
Variable next() const
Definition: factory.h:137
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:81
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
ringorder_C
Definition: ring.h:73
intStar2ZVector
gfan::ZVector intStar2ZVector(const int d, const int *i)
Definition: callgfanlib_conversion.cc:86
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1339
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:581
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:113
p_PermPoly
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:4025
res
CanonicalForm res
Definition: facAbsFact.cc:64
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
tropicalStartingPoints
gfan::ZMatrix tropicalStartingPoints
Definition: startingCone.cc:18
linealitySpaceOfGroebnerFan
static gfan::ZCone linealitySpaceOfGroebnerFan(const ideal I, const ring r)
Definition: startingCone.cc:313
groebnerCone::getPolynomialIdeal
ideal getPolynomialIdeal() const
Definition: groebnerCone.h:62
ZVectorToIntStar
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
Definition: callgfanlib_conversion.cc:110
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:171
IDEAL_CMD
Definition: grammar.cc:284
tropicalStrategy::getShortcutRing
ring getShortcutRing() const
Definition: tropicalStrategy.h:213
h
static Poly * h
Definition: janet.cc:972
groebnerCone::getPolynomialRing
ring getPolynomialRing() const
Definition: groebnerCone.h:63
createTraversalStartingRing
ring createTraversalStartingRing(const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy &currentStrategy)
Definition: startingCone.cc:338
pIter
#define pIter(p)
Definition: monomials.h:35
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
rays
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:662
gfanlib_kStd_wrapper
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:6
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1439
ringorder_lp
Definition: ring.h:77
groebnerCone
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
coneID
int coneID
Definition: bbcone.cc:25
groebnerFan
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition: groebnerFan.cc:26
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:436
groebnerCone
Definition: groebnerCone.h:27
tropicalStrategy::getStartingRing
ring getStartingRing() const
returns the polynomial ring over the valuation ring
Definition: tropicalStrategy.h:176
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1302
nCopyCoeff
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:428
tau
void tau(int **points, int sizePoints, int k)
Definition: cfNewtonPolygon.cc:461
ringorder_a
Definition: ring.h:70
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
tropicalStartingDataViaGroebnerFan
std::pair< gfan::ZVector, groebnerCone > tropicalStartingDataViaGroebnerFan(const ideal I, const ring r, const tropicalStrategy &currentStrategy)
Computes a starting point outside the lineatliy space by traversing the Groebner fan,...
Definition: startingCone.cc:80
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
sleftv::Typ
int Typ()
Definition: subexpr.cc:1038
assume
#define assume(x)
Definition: mod2.h:384
NULL
#define NULL
Definition: omList.c:9
sleftv::CopyD
void * CopyD(int t)
Definition: subexpr.cc:744
areIdealsEqual
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
Definition: tropicalDebug.cc:41
equations
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:577
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
groebnerCone::getInteriorPoint
gfan::ZVector getInteriorPoint() const
Definition: groebnerCone.h:65
tropicalStrategy::getUniformizingParameter
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
Definition: tropicalStrategy.h:207
p
int p
Definition: cfModGcd.cc:4019
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
tropicalVariety
BOOLEAN tropicalVariety(leftv res, leftv args)
Definition: tropicalVariety.cc:41
checkForMonomialViaSuddenSaturation
poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r)
Definition: containsMonomial.cc:9
n_SetMap
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
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:24
rCopy
ring rCopy(ring r)
Definition: ring.cc:1619
groebnerCone::getPolyhedralCone
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:64
rRingOrder_t
rRingOrder_t
order stuff
Definition: ring.h:67
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
tropicalStrategy::getStartingIdeal
ideal getStartingIdeal() const
returns the input ideal
Definition: tropicalStrategy.h:185
sleftv::next
leftv next
Definition: subexpr.h:85
tropicalStrategy
Definition: tropicalStrategy.h:36
nKillChar
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:511
groebnerCone::groebnerNeighbours
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
Definition: groebnerCone.cc:401
rComplete
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:3368