Functions
tropicalCurves.h File Reference
#include <gfanlib/gfanlib_zcone.h>
#include <gfanlib/gfanlib_zfan.h>
#include <polys/monomials/p_polys.h>
#include <tropicalStrategy.h>
#include <tropicalVarietyOfPolynomials.h>

Go to the source code of this file.

Functions

ZConesSortedByDimension tropicalStar (const ideal I, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
 
gfan::ZMatrix raysOfTropicalStar (ideal I, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
 

Function Documentation

◆ raysOfTropicalStar()

gfan::ZMatrix raysOfTropicalStar ( ideal  I,
const ring  r,
const gfan::ZVector &  u,
const tropicalStrategy currentStrategy 
)

Definition at line 244 of file tropicalCurves.cc.

245 {
246  ZConesSortedByDimension C = tropicalStar(I,r,u,currentStrategy);
247  // gfan::ZFan* zf = toFanStar(C);
248  // std::cout << zf->toString();
249  // delete zf;
250  gfan::ZMatrix raysOfC(0,u.size());
251  if (!currentStrategy->restrictToLowerHalfSpace())
252  {
253  for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
254  {
255  assume(zc->dimensionOfLinealitySpace()+1 >= zc->dimension());
256  if (zc->dimensionOfLinealitySpace()+1 >= zc->dimension())
257  raysOfC.appendRow(zc->getRelativeInteriorPoint());
258  else
259  {
260  gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
261  if (!currentStrategy->homogeneitySpaceContains(interiorPoint))
262  {
263  raysOfC.appendRow(interiorPoint);
264  raysOfC.appendRow(currentStrategy->negateWeight(interiorPoint));
265  }
266  else
267  {
268  gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
269  for (int i=0; i<zm.getHeight(); i++)
270  {
271  gfan::ZVector point = zm[i];
272  if (currentStrategy->homogeneitySpaceContains(point))
273  {
274  raysOfC.appendRow(point);
275  raysOfC.appendRow(currentStrategy->negateWeight(point));
276  break;
277  }
278  }
279  }
280  }
281  }
282  }
283  else
284  {
285  for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
286  {
287  assume(zc->dimensionOfLinealitySpace()+2 >= zc->dimension());
288  if (zc->dimensionOfLinealitySpace()+2 == zc->dimension())
289  raysOfC.appendRow(zc->getRelativeInteriorPoint());
290  else
291  {
292  gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
293  if (!currentStrategy->homogeneitySpaceContains(interiorPoint))
294  {
295  raysOfC.appendRow(interiorPoint);
296  raysOfC.appendRow(currentStrategy->negateWeight(interiorPoint));
297  }
298  else
299  {
300  gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
301  for (int i=0; i<zm.getHeight(); i++)
302  {
303  gfan::ZVector point = zm[i];
304  if (currentStrategy->homogeneitySpaceContains(point))
305  {
306  raysOfC.appendRow(point);
307  raysOfC.appendRow(currentStrategy->negateWeight(point));
308  break;
309  }
310  }
311  }
312  }
313  }
314  }
315  return raysOfC;
316 }
const ring r
Definition: syzextra.cc:208
std::set< gfan::ZCone, ZConeCompareDimensionFirst > ZConesSortedByDimension
#define assume(x)
Definition: mod2.h:394
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
int i
Definition: cfEzgcd.cc:123
ZConesSortedByDimension tropicalStar(ideal inI, const ring r, const gfan::ZVector &u, const tropicalStrategy *currentStrategy)
gfan::ZVector negateWeight(const gfan::ZVector &w) const
bool homogeneitySpaceContains(const gfan::ZVector &v) const
returns true, if v is contained in the homogeneity space; false otherwise

◆ tropicalStar()

ZConesSortedByDimension tropicalStar ( const ideal  I,
const ring  r,
const gfan::ZVector &  u,
const tropicalStrategy currentStrategy 
)

Definition at line 108 of file tropicalCurves.cc.

110 {
111  int k = IDELEMS(inI);
112  int d = currentStrategy->getExpectedDimension();
113 
114  /* Compute the common refinement over all tropical varieties
115  * of the polynomials in the generating set */
116  ZConesSortedByDimension C = tropicalVarietySortedByDimension(inI->m[0],r,currentStrategy);
117  int PayneOsserman = rVar(r)-1;
118  for (int i=0; i<k; i++)
119  {
120  if(inI->m[i]!=NULL)
121  {
122  PayneOsserman--;
123  C = intersect(C,tropicalVarietySortedByDimension(inI->m[i],r,currentStrategy),si_max(PayneOsserman,d));
124  }
125  }
126 
127  /* Cycle through all maximal cones of the refinement.
128  * Pick a monomial ordering corresponding to a generic weight vector in it
129  * and check if the initial ideal is monomial free, generic meaning
130  * that it lies in a maximal Groebner cone in the maximal cone of the refinement.
131  * If the initial ideal is not monomial free, compute a witness for the monomial
132  * and compute the common refinement with its tropical variety.
133  * If all initial ideals are monomial free, then we have our tropical curve */
134  // gfan::ZFan* zf = toFanStar(C);
135  // std::cout << zf->toString(2+4+8+128) << std::endl;
136  // delete zf;
137  for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end();)
138  {
139  gfan::ZVector w = zc->getRelativeInteriorPoint();
140  gfan::ZMatrix W = zc->generatorsOfSpan();
141  // std::cout << zc->extremeRays() << std::endl;
142 
143  ring s = genericlyWeightedOrdering(r,u,w,W,currentStrategy);
144  nMapFunc identity = n_SetMap(r->cf,s->cf);
145  ideal inIs = idInit(k);
146  for (int j=0; j<k; j++)
147  inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
148 
149  ideal inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
150  id_Delete(&inIs,s);
151  ideal ininIs = initial(inIsSTD,s,w,W);
152 
153  std::pair<poly,int> mons = currentStrategy->checkInitialIdealForMonomial(ininIs,s);
154 
155  if (mons.first!=NULL)
156  {
157  poly gs;
158  if (mons.second>=0)
159  // cheap way out, ininIsSTD already contains a monomial in its generators
160  gs = inIsSTD->m[mons.second];
161  else
162  // compute witness
163  gs = witness(mons.first,inIsSTD,ininIs,s);
164 
165  C = intersect(C,tropicalVarietySortedByDimension(gs,s,currentStrategy),d);
166  nMapFunc mMap = n_SetMap(s->cf,r->cf);
167  poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
168  idInsertPoly(inI,gr);
169  k++;
170 
171  if (mons.second<0)
172  {
173  // if necessary, cleanup mons and gs
174  p_Delete(&mons.first,s);
175  p_Delete(&gs,s);
176  }
177  // cleanup rest, reset zc
178  id_Delete(&inIsSTD,s);
179  id_Delete(&ininIs,s);
180  rDelete(s);
181  zc = C.begin();
182  }
183  else
184  {
185  // cleanup remaining data of first stage
186  id_Delete(&inIsSTD,s);
187  id_Delete(&ininIs,s);
188  rDelete(s);
189 
190  gfan::ZVector wNeg = currentStrategy->negateWeight(w);
191  if (zc->contains(wNeg))
192  {
193  s = genericlyWeightedOrdering(r,u,wNeg,W,currentStrategy);
194  identity = n_SetMap(r->cf,s->cf);
195  inIs = idInit(k);
196  for (int j=0; j<k; j++)
197  inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
198 
199  inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
200  id_Delete(&inIs,s);
201  ininIs = initial(inIsSTD,s,wNeg,W);
202 
203  mons = currentStrategy->checkInitialIdealForMonomial(ininIs,s);
204  if (mons.first!=NULL)
205  {
206  poly gs;
207  if (mons.second>=0)
208  // cheap way out, ininIsSTD already contains a monomial in its generators
209  gs = inIsSTD->m[mons.second];
210  else
211  // compute witness
212  gs = witness(mons.first,inIsSTD,ininIs,s);
213 
214  C = intersect(C,tropicalVarietySortedByDimension(gs,s,currentStrategy),d);
215  nMapFunc mMap = n_SetMap(s->cf,r->cf);
216  poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
217  idInsertPoly(inI,gr);
218  k++;
219 
220  if (mons.second<0)
221  {
222  // if necessary, cleanup mons and gs
223  p_Delete(&mons.first,s);
224  p_Delete(&gs,s);
225  }
226  // reset zc
227  zc = C.begin();
228  }
229  else
230  zc++;
231  // cleanup remaining data of second stage
232  id_Delete(&inIsSTD,s);
233  id_Delete(&ininIs,s);
234  rDelete(s);
235  }
236  else
237  zc++;
238  }
239  }
240  return C;
241 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static ring genericlyWeightedOrdering(const ring r, const gfan::ZVector &u, const gfan::ZVector &w, const gfan::ZMatrix &W, const tropicalStrategy *currentStrategy)
ZConesSortedByDimension tropicalVarietySortedByDimension(const poly g, const ring r, const tropicalStrategy *currentCase)
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int k
Definition: cfEzgcd.cc:93
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:3985
std::set< gfan::ZCone, ZConeCompareDimensionFirst > ZConesSortedByDimension
int j
Definition: myNF.cc:70
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:6
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
static ZConesSortedByDimension intersect(const ZConesSortedByDimension &setA, const ZConesSortedByDimension &setB, int d=0)
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
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
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
gfan::ZVector negateWeight(const gfan::ZVector &w) const
#define NULL
Definition: omList.c:10
poly witness(const poly m, const ideal I, const ideal inI, const ring r)
Let w be the uppermost weight vector in the matrix defining the ordering on r.
Definition: witness.cc:34
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
const CanonicalForm & w
Definition: facAbsFact.cc:55
std::pair< poly, int > checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector &w=0) const
If given w, assuming w is in the Groebner cone of the ordering on r and I is a standard basis with re...
polyrec * poly
Definition: hilb.h:10