Functions | Variables
startingCone.h File Reference
#include "groebnerCone.h"
#include "tropicalStrategy.h"

Go to the source code of this file.

Functions

groebnerCone groebnerStartingCone (const tropicalStrategy &currentStrategy)
 
groebnerCone tropicalStartingCone (const tropicalStrategy &currentCase)
 
BOOLEAN tropicalStartingPoint (leftv res, leftv args)
 
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 tropicalStartingCone (leftv res, leftv args)
 

Variables

gfan::ZMatrix tropicalStartingPoints
 

Function Documentation

◆ 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 }
ring getStartingRing() const
returns the polynomial ring over the valuation ring
ideal getStartingIdeal() const
returns the input ideal

◆ 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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1176
int idElem(const ideal F)
count non-zero elements

◆ 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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1176
int idElem(const ideal F)
count non-zero elements

◆ 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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1176
int idElem(const ideal F)
count non-zero elements

◆ 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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1176
int idElem(const ideal F)
count non-zero elements

◆ tropicalStartingCone() [1/2]

groebnerCone tropicalStartingCone ( const tropicalStrategy currentCase)

Definition at line 374 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;
611  }
612 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:64
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
ring getPolynomialRing() const
Definition: groebnerCone.h:63
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
int k
Definition: cfEzgcd.cc:92
static gfan::ZCone linealitySpaceOfGroebnerFan(const ideal I, const ring r)
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:411
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:26
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
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:4036
poly p_One(const ring r)
Definition: p_polys.cc:1303
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:3398
ring createTraversalStartingRing(const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy &currentStrategy)
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:6
#define assume(x)
Definition: mod2.h:390
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1365
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
#define rTest(r)
Definition: ring.h:780
poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r)
gfan::ZMatrix tropicalStartingPoints
Definition: startingCone.cc:18
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:23
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:721
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
ring rCopy(ring r)
Definition: ring.cc:1645
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:12
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
gfan::ZVector getInteriorPoint() const
Definition: groebnerCone.h:65
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.
Definition: startingCone.cc:80
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
ideal getPolynomialIdeal() const
Definition: groebnerCone.h:62

◆ tropicalStartingCone() [2/2]

BOOLEAN tropicalStartingCone ( leftv  res,
leftv  args 
)

Definition at line 614 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");
648  return TRUE;
649 }
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:64
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
leftv next
Definition: subexpr.h:86
VAR int coneID
Definition: bbcone.cc:25
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:12
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1176
int p
Definition: cfModGcd.cc:4019
void * CopyD(int t)
Definition: subexpr.cc:739

◆ tropicalStartingPoint()

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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:24
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:1033
void * data
Definition: subexpr.h:88
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN tropicalVariety(leftv res, leftv args)
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:662
#define NULL
Definition: omList.c:12
int rtyp
Definition: subexpr.h:91
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.
Definition: startingCone.cc:80
void * Data()
Definition: subexpr.cc:1176
int idElem(const ideal F)
count non-zero elements

Variable Documentation

◆ tropicalStartingPoints

gfan::ZMatrix tropicalStartingPoints

Definition at line 18 of file startingCone.cc.