Functions
startingCone.cc File Reference
#include <callgfanlib_conversion.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>

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

Function Documentation

groebnerCone groebnerStartingCone ( const tropicalStrategy currentStrategy)

Definition at line 15 of file startingCone.cc.

16 {
17  groebnerCone sigma(currentStrategy.getStartingIdeal(), currentStrategy.getStartingRing(), currentStrategy);
18  return sigma;
19 }
ring getStartingRing() const
returns the polynomial ring over the valuation ring
ideal getStartingIdeal() const
returns the input ideal
static gfan::ZCone linealitySpaceOfGroebnerFan ( const ideal  I,
const ring  r 
)
static

Definition at line 308 of file startingCone.cc.

309 {
310  int n = rVar(r);
311  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
312  int* expv = (int*) omAlloc((n+1)*sizeof(int));
313  int k = idSize(I);
314  for (int i=0; i<k; i++)
315  {
316  poly g = I->m[i];
317  if (g)
318  {
319  p_GetExpV(g,expv,r);
320  gfan::ZVector leadexp = intStar2ZVector(n,expv);
321  for (pIter(g); g; pIter(g))
322  {
323  p_GetExpV(g,expv,r);
324  equations.appendRow(leadexp-intStar2ZVector(n,expv));
325  }
326  }
327  }
328  omFreeSize(expv,(n+1)*sizeof(int));
329  return gfan::ZCone(gfan::ZMatrix(0,n),equations);
330 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
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
polyrec * poly
Definition: hilb.h:10
gfan::ZVector intStar2ZVector(const int d, const int *i)
int i
Definition: cfEzgcd.cc:123
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
BOOLEAN negativeTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 185 of file startingCone.cc.

186 {
187  leftv u = args;
188  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
189  {
190  ideal I = (ideal) u->Data();
191  if (idSize(I)==1)
192  {
193  tropicalStrategy currentStrategy(I,currRing);
194  poly g = I->m[0];
195  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
196  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
197  {
198  gfan::ZMatrix ray = zc->extremeRays();
199  for (int i=0; i<ray.getHeight(); i++)
200  {
201  gfan::ZVector negatedRay = gfan::Integer(-1)*ray[i];
202  if (negatedRay.isPositive())
203  {
204  res->rtyp = BIGINTMAT_CMD;
205  res->data = (void*) zVectorToBigintmat(ray[i]);
206  return FALSE;
207  }
208  }
209  }
210  res->rtyp = BIGINTMAT_CMD;
211  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
212  return FALSE;
213  }
214  WerrorS("negativeTropicalStartingPoint: ideal not principal");
215  return TRUE;
216  }
217  WerrorS("negativeTropicalStartingPoint: unexpected parameters");
218  return TRUE;
219 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:949
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:12
polyrec * poly
Definition: hilb.h: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:1091
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
BOOLEAN nonNegativeTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 150 of file startingCone.cc.

151 {
152  leftv u = args;
153  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
154  {
155  ideal I = (ideal) u->Data();
156  if (idSize(I)==1)
157  {
158  tropicalStrategy currentStrategy(I,currRing);
159  poly g = I->m[0];
160  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
161  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
162  {
163  gfan::ZMatrix ray = zc->extremeRays();
164  for (int i=0; i<ray.getHeight(); i++)
165  {
166  if (ray[i].isNonNegative())
167  {
168  res->rtyp = BIGINTMAT_CMD;
169  res->data = (void*) zVectorToBigintmat(ray[i]);
170  return FALSE;
171  }
172  }
173  }
174  res->rtyp = BIGINTMAT_CMD;
175  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
176  return FALSE;
177  }
178  WerrorS("nonNegativeTropicalStartingPoint: ideal not principal");
179  return TRUE;
180  }
181  WerrorS("nonNegativeTropicalStartingPoint: unexpected parameters");
182  return TRUE;
183 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:949
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:12
polyrec * poly
Definition: hilb.h: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:1091
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
BOOLEAN nonPositiveTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 221 of file startingCone.cc.

222 {
223  leftv u = args;
224  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
225  {
226  ideal I = (ideal) u->Data();
227  if (idSize(I)==1)
228  {
229  tropicalStrategy currentStrategy(I,currRing);
230  poly g = I->m[0];
231  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
232  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
233  {
234  gfan::ZMatrix ray = zc->extremeRays();
235  for (int i=0; i<ray.getHeight(); i++)
236  {
237  gfan::ZVector negatedRay = gfan::Integer(-1)*ray[i];
238  if (negatedRay.isNonNegative())
239  {
240  res->rtyp = BIGINTMAT_CMD;
241  res->data = (void*) zVectorToBigintmat(ray[i]);
242  return FALSE;
243  }
244  }
245  }
246  res->rtyp = BIGINTMAT_CMD;
247  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
248  return FALSE;
249  }
250  WerrorS("nonPositiveTropicalStartingPoint: ideal not principal");
251  return TRUE;
252  }
253  WerrorS("nonPositiveTropicalStartingPoint: unexpected parameters");
254  return TRUE;
255 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:949
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:12
polyrec * poly
Definition: hilb.h: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:1091
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
BOOLEAN positiveTropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 115 of file startingCone.cc.

116 {
117  leftv u = args;
118  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
119  {
120  ideal I = (ideal) u->Data();
121  if (idSize(I)==1)
122  {
123  tropicalStrategy currentStrategy(I,currRing);
124  poly g = I->m[0];
125  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
126  for (std::set<gfan::ZCone>::iterator zc=Tg.begin(); zc!=Tg.end(); zc++)
127  {
128  gfan::ZMatrix ray = zc->extremeRays();
129  for (int i=0; i<ray.getHeight(); i++)
130  {
131  if (ray[i].isPositive())
132  {
133  res->rtyp = BIGINTMAT_CMD;
134  res->data = (void*) zVectorToBigintmat(ray[i]);
135  return FALSE;
136  }
137  }
138  }
139  res->rtyp = BIGINTMAT_CMD;
140  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
141  return FALSE;
142  }
143  WerrorS("positiveTropicalStartingPoint: ideal not principal");
144  return TRUE;
145  }
146  WerrorS("positiveTropicalStartingPoint: unexpected parameters");
147  return TRUE;
148 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:949
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:12
polyrec * poly
Definition: hilb.h: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:1091
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
groebnerCone tropicalStartingCone ( const tropicalStrategy currentStrategy)

Definition at line 335 of file startingCone.cc.

336 {
337  ring r = currentStrategy.getStartingRing();
338  ideal I = currentStrategy.getStartingIdeal();
339  currentStrategy.reduce(I,r);
340  if (currentStrategy.isConstantCoefficientCase())
341  {
342  // copy the data, so that it be deleted when passed to the loop
343  // s <- r
344  // inI <- I
345  ring s = rCopy(r);
346  int k = idSize(I); ideal inI = idInit(k);
347  nMapFunc identityMap = n_SetMap(r->cf,s->cf);
348  for (int i=0; i<k; i++)
349  inI->m[i] = p_PermPoly(I->m[i],NULL,r,s,identityMap,NULL,0);
350 
351  // repeatedly computes a point in the tropical variety outside the lineality space,
352  // take the initial ideal with respect to it
353  // and check whether the dimension of its homogeneity space
354  // equals the dimension of the tropical variety
355  gfan::ZCone zc = linealitySpaceOfGroebnerFan(inI,s);
356  gfan::ZVector startingPoint; groebnerCone ambientMaximalCone;
357  while (zc.dimension()<currentStrategy.getExpectedDimension())
358  {
359  // compute a point in the tropical variety outside the lineality space
360  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(inI,s,currentStrategy);
361  startingPoint = startingData.first;
362  ambientMaximalCone = groebnerCone(startingData.second);
363 
364  id_Delete(&inI,s); rDelete(s);
365  inI = ambientMaximalCone.getPolynomialIdeal();
366  s = ambientMaximalCone.getPolynomialRing();
367 
368  // compute the initial ideal with respect to the weight
369  inI = initial(inI,s,startingPoint);
370  zc = linealitySpaceOfGroebnerFan(inI,s);
371  }
372 
373  // once the dimension of the homogeneity space equals that of the tropical variety
374  // we know that we have an initial ideal with respect to a weight
375  // in the relative interior of a maximal cone in the tropical variety
376  // from this we can read of the inequalities and equations
377 
378  // but before doing so, we must lift the generating set of inI
379  // to a generating set of I
380  ideal J = lift(I,r,inI,s); // todo: use computeLift from tropicalStrategy
381  groebnerCone startingCone(J,inI,s,currentStrategy);
382  id_Delete(&inI,s);
383  id_Delete(&J,s);
384 
385  // assume(checkContainmentInTropicalVariety(startingCone));
386  return startingCone;
387  }
388  else
389  {
390  // copy the data, so that it be deleted when passed to the loop
391  // s <- r
392  // inJ <- I
393  ring s = rCopy(r);
394  int k = idSize(I); ideal inJ = idInit(k);
395  nMapFunc identityMap = n_SetMap(r->cf,s->cf);
396  for (int i=0; i<k; i++)
397  inJ->m[i] = p_PermPoly(I->m[i],NULL,r,s,identityMap,NULL,0);
398 
399  // and check whether the dimension of its homogeneity space
400  // equals the dimension of the tropical variety
401  gfan::ZCone zc = linealitySpaceOfGroebnerFan(inJ,s);
402  if (zc.dimension()==currentStrategy.getExpectedDimension())
403  { // this shouldn't happen as trivial cases should be caught beforehand
404  // this is the case that the tropical variety consists soely out of the lineality space
405  groebnerCone startingCone(I,inJ,s,currentStrategy);
406  id_Delete(&inJ,s);
407  rDelete(s);
408  return startingCone;
409  }
410 
411  // compute a point in the tropical variety outside the lineality space
412  // compute the initial ideal with respect to the weight
413  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(inJ,s,currentStrategy);
414  gfan::ZVector startingPoint = startingData.first;
415  groebnerCone ambientMaximalCone = groebnerCone(startingData.second);
416  id_Delete(&inJ,s); rDelete(s);
417  inJ = ambientMaximalCone.getPolynomialIdeal();
418  s = ambientMaximalCone.getPolynomialRing();
419  inJ = initial(inJ,s,startingPoint);
420  ideal inI = initial(I,r,startingPoint);
421  zc = linealitySpaceOfGroebnerFan(inJ,s);
422 
423  // and check whether the dimension of its homogeneity space
424  // equals the dimension of the tropical variety
425  if (zc.dimension()==currentStrategy.getExpectedDimension())
426  { // this case shouldn't happen as trivial cases should be caught beforehand
427  // this is the case that the tropical variety has a one-codimensional lineality space
428  ideal J = lift(I,r,inJ,s); // todo: use computeLift from tropicalStrategy
429  groebnerCone startingCone(J,inJ,s,currentStrategy);
430  id_Delete(&inJ,s);
431  id_Delete(&J,s);
432  return startingCone;
433  }
434 
435  // from this point on, inJ contains the uniformizing parameter,
436  // hence it contains a monomial if and only if its residue over the residue field does.
437  // so we will switch to the residue field
438  ring rShortcut = rCopy0(r);
439  nKillChar(rShortcut->cf);
440  rShortcut->cf = nCopyCoeff((currentStrategy.getShortcutRing())->cf);
441  rComplete(rShortcut);
442  rTest(rShortcut);
443  k = idSize(inJ);
444  ideal inJShortcut = idInit(k);
445  nMapFunc takingResidues = n_SetMap(s->cf,rShortcut->cf);
446  for (int i=0; i<k; i++)
447  inJShortcut->m[i] = p_PermPoly(inJ->m[i],NULL,s,rShortcut,takingResidues,NULL,0);
448  idSkipZeroes(inJShortcut);
449  id_Delete(&inJ,s);
450 
451  // we are interested in a maximal cone of the tropical variety of inJShortcut
452  // this basically equivalent to the case without valuation (or constant coefficient case)
453  // except that our ideal is still only homogeneous in the later variables,
454  // hence we set the optional parameter completelyHomogeneous as 'false'
455  tropicalStrategy shortcutStrategy(inJShortcut,rShortcut,false);
456  groebnerCone startingConeShortcut = tropicalStartingCone(shortcutStrategy);
457  id_Delete(&inJShortcut,rShortcut); rDelete(rShortcut);
458 
459  // now we need to obtain the initial of the residue of inJ
460  // with respect to a weight in the tropical cone,
461  // and obtain the initial of inJ with respect to the same weight
462  ring sShortcut = startingConeShortcut.getPolynomialRing();
463  inJShortcut = startingConeShortcut.getPolynomialIdeal();
464  gfan::ZCone zd = startingConeShortcut.getPolyhedralCone();
465  gfan::ZVector interiorPoint = startingConeShortcut.getInteriorPoint();
466  inJShortcut = initial(inJShortcut,sShortcut,interiorPoint);
467  inI = initial(inI,r,interiorPoint);
468 
469  s = rCopy0(sShortcut); // s will be a ring over the valuation ring
470  nKillChar(s->cf); // with the same ordering as sShortcut
471  s->cf = nCopyCoeff(r->cf);
472  rComplete(s);
473  rTest(s);
474 
475  k = idSize(inJShortcut); // inJ will be overwritten with initial of inJ
476  inJ = idInit(k+1);
477  inJ->m[0] = p_One(s); // with respect to that weight
478  identityMap = n_SetMap(r->cf,s->cf); // first element will obviously be p
479  p_SetCoeff(inJ->m[0],identityMap(currentStrategy.getUniformizingParameter(),r->cf,s->cf),s);
480  nMapFunc findingRepresentatives = n_SetMap(sShortcut->cf,s->cf);
481  for (int i=0; i<k; i++) // and then come the rest
482  inJ->m[i+1] = p_PermPoly(inJShortcut->m[i],NULL,sShortcut,s,findingRepresentatives,NULL,0);
483 
484  ideal J = currentStrategy.computeLift(inJ,s,inI,I,r);
485  // currentStrategy.reduce(J,s);
486  groebnerCone startingCone(J,inJ,s,currentStrategy);
487  id_Delete(&inJ,s);
488  id_Delete(&J,s);
489  rDelete(s);
490  id_Delete(&inI,r);
491 
492  // assume(checkContainmentInTropicalVariety(startingCone));
493  return startingCone;
494  }
495 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
gfan::ZVector getInteriorPoint() const
Definition: groebnerCone.h:66
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
bool isConstantCoefficientCase() const
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:65
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 ...
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
int k
Definition: cfEzgcd.cc:93
static gfan::ZCone linealitySpaceOfGroebnerFan(const ideal I, const ring r)
ring getStartingRing() const
returns the polynomial ring over the valuation ring
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:401
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:24
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
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
ring getShortcutRing() 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:3371
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
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:71
#define rTest(r)
Definition: ring.h:769
ideal getPolynomialIdeal() const
Definition: groebnerCone.h:63
int i
Definition: cfEzgcd.cc:123
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:718
void idSkipZeroes(ideal ide)
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
ring rCopy(ring r)
Definition: ring.cc:1579
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
ring getPolynomialRing() const
Definition: groebnerCone.h:64
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:74
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:477
BOOLEAN tropicalStartingCone ( leftv  res,
leftv  args 
)

Definition at line 497 of file startingCone.cc.

498 {
499  leftv u = args;
500  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
501  {
502  ideal I = (ideal) u->CopyD();
503  leftv v = u->next;
504  if ((v != NULL) && (v->Typ() == NUMBER_CMD))
505  {
506  number p = (number) v->Data();
507  leftv w = v->next;
508  if (w==NULL)
509  {
510  tropicalStrategy currentStrategy(I,p,currRing);
511  groebnerCone sigma = tropicalStartingCone(currentStrategy);
512  gfan::ZCone* startingCone = new gfan::ZCone(sigma.getPolyhedralCone());
513  res->rtyp = coneID;
514  res->data = (char*) startingCone;
515  return FALSE;
516  }
517  }
518  else
519  {
520  if (v==NULL)
521  {
522  tropicalStrategy currentStrategy(I,currRing);
523  groebnerCone sigma = tropicalStartingCone(currentStrategy);
524  res->rtyp = coneID;
525  res->data = (char*) new gfan::ZCone(sigma.getPolyhedralCone());
526  return FALSE;
527  }
528  }
529  }
530  WerrorS("tropicalStartingCone: unexpected parameters");
531  return TRUE;
532 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:65
#define TRUE
Definition: auxiliary.h:144
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:949
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:12
int coneID
Definition: bbcone.cc:24
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:1091
void * CopyD(int t)
Definition: subexpr.cc:656
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 74 of file startingCone.cc.

75 {
76  // start by computing a maximal Groebner cone and
77  // check whether one of its rays lies in the tropical variety
78  const groebnerCone sigma(I,r,currentStrategy);
79  gfan::ZVector startingPoint = sigma.tropicalPoint();
80  if (startingPoint.size() > 0)
81  return std::make_pair(startingPoint,sigma);
82 
83  // if not, traverse the groebnerFan and until such a cone is found
84  // and return the maximal cone together with a point in its ray
86  groebnerCones workingList;
87  workingList.insert(sigma);
88  while (!workingList.empty())
89  {
90  const groebnerCone sigma = *(workingList.begin());
91  groebnerCones neighbours = sigma.groebnerNeighbours();
92  for (groebnerCones::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++)
93  {
94  if (groebnerFan.count(*tau) == 0)
95  {
96  if (workingList.count(*tau) == 0)
97  {
98  startingPoint = tau->tropicalPoint();
99  if (startingPoint.size() > 0)
100  return std::make_pair(startingPoint,*tau);
101  }
102  workingList.insert(*tau);
103  }
104  }
105  groebnerFan.insert(sigma);
106  workingList.erase(sigma);
107  }
108 
109  // return some trivial output, if such a cone cannot be found
110  gfan::ZVector emptyVector = gfan::ZVector(0);
111  groebnerCone emptyCone = groebnerCone();
112  return std::pair<gfan::ZVector,groebnerCone>(emptyVector,emptyCone);
113 }
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
const ring r
Definition: syzextra.cc:208
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
void tau(int **points, int sizePoints, int k)
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 27 of file startingCone.cc.

28 {
29  // start by computing a maximal Groebner cone and
30  // check whether one of its rays lies in the tropical variety
31  const groebnerCone sigma(I,r,currentStrategy);
32  gfan::ZVector startingPoint = sigma.tropicalPoint();
33  if (startingPoint.size() > 0)
34  return std::make_pair(startingPoint,sigma);
35 
36  // if not, traverse the groebnerFan and until such a cone is found
37  // and return the maximal cone together with a point in its ray
39  groebnerCones workingList;
40  workingList.insert(sigma);
41  while (!workingList.empty())
42  {
43  const groebnerCone sigma = *(workingList.begin());
44  groebnerCones neighbours = sigma.groebnerNeighbours();
45  for (groebnerCones::iterator tau = neighbours.begin(); tau!=neighbours.end(); tau++)
46  {
47  if (groebnerFan.count(*tau) == 0)
48  {
49  if (workingList.count(*tau) == 0)
50  {
51  startingPoint = tau->tropicalPoint();
52  if (startingPoint.size() > 0)
53  return std::make_pair(startingPoint,*tau);
54  }
55  workingList.insert(*tau);
56  }
57  }
58  groebnerFan.insert(sigma);
59  workingList.erase(sigma);
60  }
61 
62  // return some trivial output, if such a cone cannot be found
63  gfan::ZVector emptyVector = gfan::ZVector(0);
64  groebnerCone emptyCone = groebnerCone();
65  return std::pair<gfan::ZVector,groebnerCone>(emptyVector,emptyCone);
66 }
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
const ring r
Definition: syzextra.cc:208
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
void tau(int **points, int sizePoints, int k)
BOOLEAN tropicalStartingPoint ( leftv  res,
leftv  args 
)

Definition at line 257 of file startingCone.cc.

258 {
259  leftv u = args;
260  if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
261  {
262  ideal I = (ideal) u->Data();
263  tropicalStrategy currentStrategy(I,currRing);
264  if (idSize(I)==1)
265  {
266  poly g = I->m[0];
267  std::set<gfan::ZCone> Tg = tropicalVariety(g,currRing,&currentStrategy);
268  if (Tg.empty())
269  {
270  res->rtyp = BIGINTMAT_CMD;
271  res->data = (void*) zVectorToBigintmat(gfan::ZVector(0));
272  return FALSE;
273  }
274  gfan::ZCone C = *(Tg.begin());
275  gfan::ZMatrix rays = C.extremeRays();
276  if (rays.getHeight()==0)
277  {
278  gfan::ZMatrix lin = C.generatorsOfLinealitySpace();
279  res->rtyp = BIGINTMAT_CMD;
280  res->data = (void*) zVectorToBigintmat(lin[0]);
281  return FALSE;
282  }
283  res->rtyp = BIGINTMAT_CMD;
284  res->data = (void*) zVectorToBigintmat(rays[0]);
285  return FALSE;
286  }
287  gfan::ZCone C0 = currentStrategy.getHomogeneitySpace();
288  if (C0.dimension()==currentStrategy.getExpectedDimension())
289  {
290  gfan::ZMatrix lin = C0.generatorsOfLinealitySpace();
291  res->rtyp = BIGINTMAT_CMD;
292  res->data = (void*) zVectorToBigintmat(lin[0]);
293  return FALSE;
294  }
295  std::pair<gfan::ZVector,groebnerCone> startingData = tropicalStartingDataViaGroebnerFan(I,currRing,currentStrategy);
296  gfan::ZVector startingPoint = startingData.first;
297  res->rtyp = BIGINTMAT_CMD;
298  res->data = (void*) zVectorToBigintmat(startingPoint);
299  return FALSE;
300  }
301  WerrorS("tropicalStartingPoint: unexpected parameters");
302  return TRUE;
303 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:949
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:12
polyrec * poly
Definition: hilb.h:10
BOOLEAN tropicalVariety(leftv res, leftv args)
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
#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:74
void * Data()
Definition: subexpr.cc:1091
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46