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 249 of file tropicalCurves.cc.

250 {
251  ZConesSortedByDimension C = tropicalStar(I,r,u,currentStrategy);
252  // gfan::ZFan* zf = toFanStar(C);
253  // std::cout << zf->toString();
254  // delete zf;
255  gfan::ZMatrix raysOfC(0,u.size());
256  if (!currentStrategy->restrictToLowerHalfSpace())
257  {
258  for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
259  {
260  assume(zc->dimensionOfLinealitySpace()+1 >= zc->dimension());
261  if (zc->dimensionOfLinealitySpace()+1 >= zc->dimension())
262  raysOfC.appendRow(zc->getRelativeInteriorPoint());
263  else
264  {
265  gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
266  if (!currentStrategy->homogeneitySpaceContains(interiorPoint))
267  {
268  raysOfC.appendRow(interiorPoint);
269  raysOfC.appendRow(currentStrategy->negateWeight(interiorPoint));
270  }
271  else
272  {
273  gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
274  for (int i=0; i<zm.getHeight(); i++)
275  {
276  gfan::ZVector point = zm[i];
277  if (currentStrategy->homogeneitySpaceContains(point))
278  {
279  raysOfC.appendRow(point);
280  raysOfC.appendRow(currentStrategy->negateWeight(point));
281  break;
282  }
283  }
284  }
285  }
286  }
287  }
288  else
289  {
290  for (ZConesSortedByDimension::iterator zc=C.begin(); zc!=C.end(); zc++)
291  {
292  assume(zc->dimensionOfLinealitySpace()+2 >= zc->dimension());
293  if (zc->dimensionOfLinealitySpace()+2 == zc->dimension())
294  raysOfC.appendRow(zc->getRelativeInteriorPoint());
295  else
296  {
297  gfan::ZVector interiorPoint = zc->getRelativeInteriorPoint();
298  if (!currentStrategy->homogeneitySpaceContains(interiorPoint))
299  {
300  raysOfC.appendRow(interiorPoint);
301  raysOfC.appendRow(currentStrategy->negateWeight(interiorPoint));
302  }
303  else
304  {
305  gfan::ZMatrix zm = zc->generatorsOfLinealitySpace();
306  for (int i=0; i<zm.getHeight(); i++)
307  {
308  gfan::ZVector point = zm[i];
309  if (currentStrategy->homogeneitySpaceContains(point))
310  {
311  raysOfC.appendRow(point);
312  raysOfC.appendRow(currentStrategy->negateWeight(point));
313  break;
314  }
315  }
316  }
317  }
318  }
319  }
320  return raysOfC;
321 }
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 113 of file tropicalCurves.cc.

115 {
116  int k = IDELEMS(inI);
117  int d = currentStrategy->getExpectedDimension();
118 
119  /* Compute the common refinement over all tropical varieties
120  * of the polynomials in the generating set */
121  ZConesSortedByDimension C = tropicalVarietySortedByDimension(inI->m[0],r,currentStrategy);
122  int PayneOsserman = rVar(r)-1;
123  for (int i=0; i<k; i++)
124  {
125  if(inI->m[i]!=NULL)
126  {
127  PayneOsserman--;
128  C = intersect(C,tropicalVarietySortedByDimension(inI->m[i],r,currentStrategy),si_max(PayneOsserman,d));
129  }
130  }
131 
132  /* Cycle through all maximal cones of the refinement.
133  * Pick a monomial ordering corresponding to a generic weight vector in it
134  * and check if the initial ideal is monomial free, generic meaning
135  * that it lies in a maximal Groebner cone in the maximal cone of the refinement.
136  * If the initial ideal is not monomial free, compute a witness for the monomial
137  * and compute the common refinement with its tropical variety.
138  * If all initial ideals are monomial free, then we have our tropical curve */
139  // gfan::ZFan* zf = toFanStar(C);
140  // std::cout << zf->toString(2+4+8+128) << std::endl;
141  // delete zf;
142  for (std::set<gfan::ZCone>::iterator zc=C.begin(); zc!=C.end();)
143  {
144  gfan::ZVector w = zc->getRelativeInteriorPoint();
145  gfan::ZMatrix W = zc->generatorsOfSpan();
146  // std::cout << zc->extremeRays() << std::endl;
147 
148  ring s = genericlyWeightedOrdering(r,u,w,W,currentStrategy);
149  nMapFunc identity = n_SetMap(r->cf,s->cf);
150  ideal inIs = idInit(k);
151  for (int j=0; j<k; j++)
152  inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
153 
154  ideal inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
155  id_Delete(&inIs,s);
156  ideal ininIs = initial(inIsSTD,s,w,W);
157 
158  std::pair<poly,int> mons = currentStrategy->checkInitialIdealForMonomial(ininIs,s);
159 
160  if (mons.first!=NULL)
161  {
162  poly gs;
163  if (mons.second>=0)
164  // cheap way out, ininIsSTD already contains a monomial in its generators
165  gs = inIsSTD->m[mons.second];
166  else
167  // compute witness
168  gs = witness(mons.first,inIsSTD,ininIs,s);
169 
170  C = intersect(C,tropicalVarietySortedByDimension(gs,s,currentStrategy),d);
171  nMapFunc mMap = n_SetMap(s->cf,r->cf);
172  poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
173  idInsertPoly(inI,gr);
174  k++;
175 
176  if (mons.second<0)
177  {
178  // if necessary, cleanup mons and gs
179  p_Delete(&mons.first,s);
180  p_Delete(&gs,s);
181  }
182  // cleanup rest, reset zc
183  id_Delete(&inIsSTD,s);
184  id_Delete(&ininIs,s);
185  rDelete(s);
186  zc = C.begin();
187  }
188  else
189  {
190  // cleanup remaining data of first stage
191  id_Delete(&inIsSTD,s);
192  id_Delete(&ininIs,s);
193  rDelete(s);
194 
195  gfan::ZVector wNeg = currentStrategy->negateWeight(w);
196  if (zc->contains(wNeg))
197  {
198  s = genericlyWeightedOrdering(r,u,wNeg,W,currentStrategy);
199  identity = n_SetMap(r->cf,s->cf);
200  inIs = idInit(k);
201  for (int j=0; j<k; j++)
202  inIs->m[j] = p_PermPoly(inI->m[j],NULL,r,s,identity,NULL,0);
203 
204  inIsSTD = gfanlib_kStd_wrapper(inIs,s,isHomog);
205  id_Delete(&inIs,s);
206  ininIs = initial(inIsSTD,s,wNeg,W);
207 
208  mons = currentStrategy->checkInitialIdealForMonomial(ininIs,s);
209  if (mons.first!=NULL)
210  {
211  poly gs;
212  if (mons.second>=0)
213  // cheap way out, ininIsSTD already contains a monomial in its generators
214  gs = inIsSTD->m[mons.second];
215  else
216  // compute witness
217  gs = witness(mons.first,inIsSTD,ininIs,s);
218 
219  C = intersect(C,tropicalVarietySortedByDimension(gs,s,currentStrategy),d);
220  nMapFunc mMap = n_SetMap(s->cf,r->cf);
221  poly gr = p_PermPoly(gs,NULL,s,r,mMap,NULL,0);
222  idInsertPoly(inI,gr);
223  k++;
224 
225  if (mons.second<0)
226  {
227  // if necessary, cleanup mons and gs
228  p_Delete(&mons.first,s);
229  p_Delete(&gs,s);
230  }
231  // reset zc
232  zc = C.begin();
233  }
234  else
235  zc++;
236  // cleanup remaining data of second stage
237  id_Delete(&inIsSTD,s);
238  id_Delete(&ininIs,s);
239  rDelete(s);
240  }
241  else
242  zc++;
243  }
244  }
245  return C;
246 }
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:3938
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