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 339 of file startingCone.cc.

340 {
341  // copy r except qideal (which should be 0) and ordering
342  ring s0 = rCopy0(s);
343  int n = rVar(s);
344  deleteOrdering(s0);
345  bool ok;
346 
347  // adjust weight and create new ordering
348  int h = startingPoints.getHeight();
349  s0->order = (int*) omAlloc0((h+3)*sizeof(int));
350  s0->block0 = (int*) omAlloc0((h+3)*sizeof(int));
351  s0->block1 = (int*) omAlloc0((h+3)*sizeof(int));
352  s0->wvhdl = (int**) omAlloc0((h+3)*sizeof(int**));
353  for (int i=0; i<h; i++)
354  {
355  s0->order[i] = ringorder_a;
356  s0->block0[i] = 1;
357  s0->block1[i] = n;
358  s0->wvhdl[i] = ZVectorToIntStar(startingPoints[i],ok);
359  }
360  s0->order[h] = ringorder_lp;
361  s0->block0[h] = 1;
362  s0->block1[h] = n;
363  s0->order[h+1] = ringorder_C;
364 
365  rComplete(s0);
366  rTest(s0);
367 
368  return s0;
369 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
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:3351
void deleteOrdering(ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
#define rTest(r)
Definition: ring.h:775
int i
Definition: cfEzgcd.cc:123
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ 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

§ linealitySpaceOfGroebnerFan()

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

Definition at line 314 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);
336 }
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1443
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
gfan::ZVector intStar2ZVector(const int d, const int *i)
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:548
polyrec * poly
Definition: hilb.h:10

§ 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:83
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10

§ 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:83
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10

§ 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:83
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10

§ 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:83
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN tropicalVariety(leftv res, leftv args)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10

§ tropicalStartingCone() [1/2]

groebnerCone tropicalStartingCone ( const tropicalStrategy currentStrategy)

Definition at line 375 of file startingCone.cc.

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

§ tropicalStartingCone() [2/2]

BOOLEAN tropicalStartingCone ( leftv  res,
leftv  args 
)

Definition at line 615 of file startingCone.cc.

616 {
617  leftv u = args;
618  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
619  {
620  ideal I = (ideal) u->CopyD();
621  leftv v = u->next;
622  if ((v != NULL) && (v->Typ() == NUMBER_CMD))
623  {
624  number p = (number) v->Data();
625  leftv w = v->next;
626  if (w==NULL)
627  {
628  tropicalStrategy currentStrategy(I,p,currRing);
629  groebnerCone sigma = tropicalStartingCone(currentStrategy);
630  gfan::ZCone* startingCone = new gfan::ZCone(sigma.getPolyhedralCone());
631  res->rtyp = coneID;
632  res->data = (char*) startingCone;
633  return FALSE;
634  }
635  }
636  else
637  {
638  if (v==NULL)
639  {
640  tropicalStrategy currentStrategy(I,currRing);
641  groebnerCone sigma = tropicalStartingCone(currentStrategy);
642  res->rtyp = coneID;
643  res->data = (char*) new gfan::ZCone(sigma.getPolyhedralCone());
644  return FALSE;
645  }
646  }
647  }
648  WerrorS("tropicalStartingCone: unexpected parameters");
649  return TRUE;
650 }
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:65
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:99
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int coneID
Definition: bbcone.cc:26
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
void * CopyD(int t)
Definition: subexpr.cc:714

§ 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 }
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition: groebnerFan.cc:28
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:24
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
const ring r
Definition: syzextra.cc:208
void tau(int **points, int sizePoints, int k)

§ 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 }
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition: groebnerFan.cc:28
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:24
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
const ring r
Definition: syzextra.cc:208
void tau(int **points, int sizePoints, int k)

§ 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 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1004
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN tropicalVariety(leftv res, leftv args)
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:628
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
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:1146
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10

Variable Documentation

§ tropicalStartingPoints

gfan::ZMatrix tropicalStartingPoints

Definition at line 18 of file startingCone.cc.