My Project
Loading...
Searching...
No Matches
startingCone.cc
Go to the documentation of this file.
2#include "singularWishlist.h"
3#include "tropicalDebug.h"
4#include "containsMonomial.h"
5#include "tropical.h"
6#include "initial.h"
7#include "lift.h"
8#include "groebnerCone.h"
9#include "tropicalStrategy.h"
10#include "tropicalCurves.h"
11#include "bbcone.h"
13#include "tropicalVariety.h"
14#include "tropicalStrategy.h"
15#include "std_wrapper.h"
16
17
19
20
22{
23 groebnerCone sigma(currentStrategy.getStartingIdeal(), currentStrategy.getStartingRing(), currentStrategy);
24 return sigma;
25}
26
27
28/**
29 * Computes a starting point outside the lineatliy space by traversing the Groebner fan,
30 * checking each cone whether it contains a ray in the tropical variety.
31 * Returns a point in the tropical variety and a maximal Groebner cone containing the point.
32 **/
33std::pair<gfan::ZVector,groebnerCone> tropicalStartingPoint(const ideal I, const ring r, const tropicalStrategy& currentStrategy)
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}
73
74
75/**
76 * Computes a starting point outside the lineatliy space by traversing the Groebner fan,
77 * checking each cone whether it contains a ray in the tropical variety.
78 * Returns a point in the tropical variety and a maximal Groebner cone containing the point.
79 **/
80std::pair<gfan::ZVector,groebnerCone> tropicalStartingDataViaGroebnerFan(const ideal I, const ring r, const tropicalStrategy& currentStrategy)
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}
120
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}
155
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}
190
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}
226
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}
262
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}
310
311/***
312 * returs the lineality space of the Groebner fan
313 **/
314static gfan::ZCone linealitySpaceOfGroebnerFan(const ideal I, const ring r)
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}
337
338
339ring createTraversalStartingRing(const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy& currentStrategy)
340{
341 // copy r except qideal (which should be 0) and ordering
342 ring s0 = rCopy0(s,FALSE,FALSE);
343 int n = rVar(s);
344 bool ok;
345
346 // adjust weight and create new ordering
347 int h = startingPoints.getHeight();
348 s0->order = (rRingOrder_t*) omAlloc0((h+3)*sizeof(rRingOrder_t));
349 s0->block0 = (int*) omAlloc0((h+3)*sizeof(int));
350 s0->block1 = (int*) omAlloc0((h+3)*sizeof(int));
351 s0->wvhdl = (int**) omAlloc0((h+3)*sizeof(int**));
352 for (int i=0; i<h; i++)
353 {
354 s0->order[i] = ringorder_a;
355 s0->block0[i] = 1;
356 s0->block1[i] = n;
357 s0->wvhdl[i] = ZVectorToIntStar(startingPoints[i],ok);
358 }
359 s0->order[h] = ringorder_lp;
360 s0->block0[h] = 1;
361 s0->block1[h] = n;
362 s0->order[h+1] = ringorder_C;
363
364 rComplete(s0);
365 rTest(s0);
366
367 return s0;
368}
369
370
371/***
372 * Computes a starting cone in the tropical variety.
373 **/
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
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);
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
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);
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}
613
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}
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:577
VAR int coneID
Definition: bbcone.cc:25
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:662
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
gfan::ZVector intStar2ZVector(const int d, const int *i)
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
int p
Definition: cfModGcd.cc:4078
g
Definition: cfModGcd.cc:4090
void tau(int **points, int sizePoints, int k)
Variable next() const
Definition: variable.h:52
gfan::ZVector tropicalPoint() const
Returns a point in the tropical variety, if the groebnerCone contains one.
groebnerCones groebnerNeighbours() const
Returns a complete list of neighboring Groebner cones.
gfan::ZCone getPolyhedralCone() const
Definition: groebnerCone.h:64
ideal getPolynomialIdeal() const
Definition: groebnerCone.h:62
ring getPolynomialRing() const
Definition: groebnerCone.h:63
gfan::ZVector getInteriorPoint() const
Definition: groebnerCone.h:65
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void * CopyD(int t)
Definition: subexpr.cc:710
int Typ()
Definition: subexpr.cc:1019
void * Data()
Definition: subexpr.cc:1162
leftv next
Definition: subexpr.h:86
bool isValuationTrivial() const
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 ...
gfan::ZCone getHomogeneitySpace() const
returns the homogeneity space of the preimage ideal
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
ring getStartingRing() const
returns the polynomial ring over the valuation ring
ideal getStartingIdeal() const
returns the input ideal
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
ring getShortcutRing() const
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:697
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:430
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:568
poly checkForMonomialViaSuddenSaturation(const ideal I, const ring r)
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
const CanonicalForm & w
Definition: facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
void WerrorS(const char *s)
Definition: feFopen.cc:24
@ IDEAL_CMD
Definition: grammar.cc:284
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ NUMBER_CMD
Definition: grammar.cc:288
implementation of the class groebnerCone
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:24
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition: groebnerFan.cc:28
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
STATIC_VAR Poly * h
Definition: janet.cc:971
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:26
#define assume(x)
Definition: mod2.h:389
#define pIter(p)
Definition: monomials.h:37
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
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:4130
poly p_One(const ring r)
Definition: p_polys.cc:1313
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:410
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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:3450
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1421
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
ring rCopy(ring r)
Definition: ring.cc:1731
rRingOrder_t
order stuff
Definition: ring.h:68
@ ringorder_lp
Definition: ring.h:77
@ ringorder_a
Definition: ring.h:70
@ ringorder_C
Definition: ring.h:73
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
#define rTest(r)
Definition: ring.h:782
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define IDELEMS(i)
Definition: simpleideals.h:23
static int idElem(const ideal F)
number of non-zero polys in F
Definition: simpleideals.h:67
gfan::ZMatrix tropicalStartingPoints
Definition: startingCone.cc:18
static gfan::ZCone linealitySpaceOfGroebnerFan(const ideal I, const ring r)
BOOLEAN nonPositiveTropicalStartingPoint(leftv res, leftv args)
ring createTraversalStartingRing(const ring s, const gfan::ZMatrix &startingPoints, const tropicalStrategy &currentStrategy)
BOOLEAN positiveTropicalStartingPoint(leftv res, leftv args)
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,...
Definition: startingCone.cc:33
BOOLEAN nonNegativeTropicalStartingPoint(leftv res, leftv args)
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
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,...
Definition: startingCone.cc:80
groebnerCone groebnerStartingCone(const tropicalStrategy &currentStrategy)
Definition: startingCone.cc:21
BOOLEAN negativeTropicalStartingPoint(leftv res, leftv args)
ideal gfanlib_kStd_wrapper(ideal I, ring r, tHomog h=testHomog)
Definition: std_wrapper.cc:6
bool areIdealsEqual(ideal I, ring r, ideal J, ring s)
implementation of the class tropicalStrategy
BOOLEAN tropicalVariety(leftv res, leftv args)