Functions | Variables
tropical.cc File Reference
#include <polys/monomials/p_polys.h>
#include <coeffs/coeffs.h>
#include <callgfanlib_conversion.h>
#include <bbcone.h>
#include <ppinitialReduction.h>
#include <containsMonomial.h>
#include <initial.h>
#include <witness.h>
#include <tropicalCurves.h>
#include <tropicalStrategy.h>
#include <startingCone.h>
#include <groebnerFan.h>
#include <groebnerComplex.h>
#include <tropicalVariety.h>

Go to the source code of this file.

Functions

gfan::ZCone homogeneitySpace (ideal I, ring r)
 
BOOLEAN homogeneitySpace (leftv res, leftv args)
 
gfan::ZCone lowerHomogeneitySpace (ideal I, ring r)
 
BOOLEAN lowerHomogeneitySpace (leftv res, leftv args)
 
gfan::ZCone groebnerCone (const ideal I, const ring r, const gfan::ZVector &w)
 
BOOLEAN groebnerCone (leftv res, leftv args)
 
gfan::ZCone maximalGroebnerCone (const ideal &I, const ring &r)
 
BOOLEAN maximalGroebnerCone (leftv res, leftv args)
 
BOOLEAN initial (leftv res, leftv args)
 
void tropical_setup (SModulFunctions *p)
 

Variables

int tropicalVerboseLevel = 0
 

Function Documentation

gfan::ZCone groebnerCone ( const ideal  I,
const ring  r,
const gfan::ZVector &  w 
)

Definition at line 156 of file tropical.cc.

157 {
158  int n = rVar(r);
159  poly g = NULL;
160  int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
161  int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
162  gfan::ZVector leadexpw = gfan::ZVector(n);
163  gfan::ZVector tailexpw = gfan::ZVector(n);
164 
165  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
166  for (int i=0; i<idSize(I); i++)
167  {
168  g = (poly) I->m[i];
169  if (g!=NULL)
170  {
171  p_GetExpV(g,leadexpv,currRing);
172  leadexpw = intStar2ZVector(n, leadexpv);
173  pIter(g);
174  while (g!=NULL)
175  {
176  pGetExpV(g,tailexpv);
177  tailexpw = intStar2ZVector(n, tailexpv);
178  inequalities.appendRow(leadexpw-tailexpw);
179  pIter(g);
180  }
181  }
182  }
183 
184  ideal inI = initial(I,currRing,w);
185  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
186  for (int i=0; i<idSize(I); i++)
187  {
188  g = (poly) inI->m[i];
189  if (g!=NULL)
190  {
191  p_GetExpV(g,leadexpv,currRing);
192  leadexpw = intStar2ZVector(n, leadexpv);
193  pIter(g);
194  while (g!=NULL)
195  {
196  pGetExpV(g,tailexpv);
197  tailexpw = intStar2ZVector(n, tailexpv);
198  equations.appendRow(leadexpw-tailexpw);
199  pIter(g);
200  }
201  }
202  }
203 
204  omFreeSize(leadexpv,(n+1)*sizeof(int));
205  omFreeSize(tailexpv,(n+1)*sizeof(int));
206  id_Delete(&inI,currRing);
207  return gfan::ZCone(inequalities,equations);
208 }
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:540
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
g
Definition: cfModGcd.cc:4031
#define omAlloc(size)
Definition: omAllocDecl.h:210
int int kStrategy strat if(h==NULL) return NULL
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
const ring r
Definition: syzextra.cc:208
gfan::ZVector intStar2ZVector(const int d, const int *i)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
BOOLEAN initial(leftv res, leftv args)
Definition: tropical.cc:369
static int idSize(const ideal id)
Count the effective size of an ideal (without the trailing allocated zero-elements) ...
Definition: ideals.h:46
polyrec * poly
Definition: hilb.h:10
BOOLEAN groebnerCone ( leftv  res,
leftv  args 
)

Definition at line 211 of file tropical.cc.

212 {
213  leftv u = args;
214  if ((u != NULL) && (u->Typ() == POLY_CMD))
215  {
216  leftv v = u->next;
217  if ((v !=NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
218  {
219  try
220  {
221  poly g = (poly) u->Data();
222  ideal I = idInit(1);
223  I->m[0] = g;
224  gfan::ZVector* weightVector;
225  if (v->Typ() == INTVEC_CMD)
226  {
227  intvec* w0 = (intvec*) v->Data();
228  bigintmat* w1 = iv2bim(w0,coeffs_BIGINT);
229  w1->inpTranspose();
230  weightVector = bigintmatToZVector(*w1);
231  delete w1;
232  }
233  else
234  {
235  bigintmat* w1 = (bigintmat*) v->Data();
236  weightVector = bigintmatToZVector(*w1);
237  }
238  res->rtyp = coneID;
239  res->data = (void*) new gfan::ZCone(groebnerCone(I,currRing,*weightVector));
240  delete weightVector;
241  I->m[0] = NULL;
242  id_Delete(&I,currRing);
243  return FALSE;
244  }
245  catch (const std::exception& ex)
246  {
247  Werror("ERROR: %s",ex.what());
248  return TRUE;
249  }
250  }
251  }
252  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
253  {
254  leftv v = u->next;
255  if ((v !=NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
256  {
257  try
258  {
259  ideal I = (ideal) u->Data();
260  gfan::ZVector* weightVector;
261  if (v->Typ() == INTVEC_CMD)
262  {
263  intvec* w0 = (intvec*) v->Data();
264  bigintmat* w1 = iv2bim(w0,coeffs_BIGINT);
265  w1->inpTranspose();
266  weightVector = bigintmatToZVector(*w1);
267  delete w1;
268  }
269  else
270  {
271  bigintmat* w1 = (bigintmat*) v->Data();
272  weightVector = bigintmatToZVector(*w1);
273  }
274  res->rtyp = coneID;
275  res->data = (void*) new gfan::ZCone(groebnerCone(I,currRing,*weightVector));
276  delete weightVector;
277  return FALSE;
278  }
279  catch (const std::exception& ex)
280  {
281  Werror("ERROR: %s",ex.what());
282  return TRUE;
283  }
284  }
285  }
286  WerrorS("groebnerCone: unexpected parameters");
287  return TRUE;
288 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
gfan::ZCone groebnerCone(const ideal I, const ring r, const gfan::ZVector &w)
Definition: tropical.cc:156
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
void inpTranspose()
transpose in place
Definition: bigintmat.cc:51
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
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
Definition: intvec.h:16
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
gfan::ZCone homogeneitySpace ( ideal  I,
ring  r 
)

Definition at line 19 of file tropical.cc.

20 {
21  int n = rVar(r);
22  poly g;
23  int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
24  int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
25  gfan::ZVector leadexpw = gfan::ZVector(n);
26  gfan::ZVector tailexpw = gfan::ZVector(n);
27  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
28  for (int i=0; i<IDELEMS(I); i++)
29  {
30  g = (poly) I->m[i];
31  if (g)
32  {
33  p_GetExpV(g,leadexpv,r);
34  leadexpw = intStar2ZVector(n,leadexpv);
35  pIter(g);
36  while (g)
37  {
38  p_GetExpV(g,tailexpv,r);
39  tailexpw = intStar2ZVector(n,tailexpv);
40  equations.appendRow(leadexpw-tailexpw);
41  pIter(g);
42  }
43  }
44  }
45  omFreeSize(leadexpv,(n+1)*sizeof(int));
46  omFreeSize(tailexpv,(n+1)*sizeof(int));
47  return gfan::ZCone(gfan::ZMatrix(0, equations.getWidth()),equations);
48 }
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:540
g
Definition: cfModGcd.cc:4031
#define omAlloc(size)
Definition: omAllocDecl.h:210
int int kStrategy strat if(h==NULL) return NULL
#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:543
polyrec * poly
Definition: hilb.h:10
BOOLEAN homogeneitySpace ( leftv  res,
leftv  args 
)

Definition at line 51 of file tropical.cc.

52 {
53  leftv u = args;
54  if ((u != NULL) && (u->Typ() == POLY_CMD))
55  {
56  leftv v = u->next;
57  if (v == NULL)
58  {
59  poly g = (poly) u->Data();
60  ideal I = idInit(1);
61  I->m[0] = g;
62  res->rtyp = coneID;
63  res->data = (void*) new gfan::ZCone(homogeneitySpace(I,currRing));
64  I->m[0] = NULL;
65  id_Delete(&I,currRing);
66  return FALSE;
67  }
68  }
69  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
70  {
71  leftv v = u->next;
72  if (v == NULL)
73  {
74  ideal I = (ideal) u->Data();
75  res->rtyp = coneID;
76  res->data = (void*) new gfan::ZCone(homogeneitySpace(I,currRing));
77  return FALSE;
78  }
79  }
80  WerrorS("homogeneitySpace: unexpected parameters");
81  return TRUE;
82 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
gfan::ZCone homogeneitySpace(ideal I, ring r)
Definition: tropical.cc:19
#define FALSE
Definition: auxiliary.h:140
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
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
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
BOOLEAN initial ( leftv  res,
leftv  args 
)

Definition at line 369 of file tropical.cc.

370 {
371  leftv u = args;
372  if ((u != NULL) && (u->Typ() == POLY_CMD))
373  {
374  leftv v = u->next;
375  if ((v !=NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
376  {
377  poly p = (poly) u->Data();
378  gfan::ZVector* weightVector;
379  if (v->Typ() == INTVEC_CMD)
380  {
381  intvec* w0 = (intvec*) v->Data();
382  bigintmat* w1 = iv2bim(w0,coeffs_BIGINT);
383  w1->inpTranspose();
384  weightVector = bigintmatToZVector(*w1);
385  delete w1;
386  }
387  else
388  {
389  bigintmat* w1 = (bigintmat*) v->Data();
390  weightVector = bigintmatToZVector(*w1);
391  }
392  res->rtyp = POLY_CMD;
393  res->data = (void*) initial(p, currRing, *weightVector);
394  delete weightVector;
395  return FALSE;
396  }
397  }
398  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
399  {
400  leftv v = u->next;
401  if ((v !=NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
402  {
403  try
404  {
405  ideal I = (ideal) u->Data();
406  gfan::ZVector* weightVector;
407  if (v->Typ() == INTVEC_CMD)
408  {
409  intvec* w0 = (intvec*) v->Data();
410  bigintmat* w1 = iv2bim(w0,coeffs_BIGINT);
411  w1->inpTranspose();
412  weightVector = bigintmatToZVector(*w1);
413  delete w1;
414  }
415  else
416  {
417  bigintmat* w1 = (bigintmat*) v->Data();
418  weightVector = bigintmatToZVector(*w1);
419  }
420  res->rtyp = IDEAL_CMD;
421  res->data = (void*) initial(I, currRing, *weightVector);
422  delete weightVector;
423  return FALSE;
424  }
425  catch (const std::exception& ex)
426  {
427  Werror("ERROR: %s",ex.what());
428  return TRUE;
429  }
430  }
431  }
432  WerrorS("initial: unexpected parameters");
433  return TRUE;
434 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:32
void inpTranspose()
transpose in place
Definition: bigintmat.cc:51
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
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
Definition: intvec.h:16
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN initial(leftv res, leftv args)
Definition: tropical.cc:369
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
gfan::ZCone lowerHomogeneitySpace ( ideal  I,
ring  r 
)

Definition at line 85 of file tropical.cc.

86 {
87  int n = rVar(r);
88  poly g;
89  int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
90  int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
91  gfan::ZVector leadexpw = gfan::ZVector(n);
92  gfan::ZVector tailexpw = gfan::ZVector(n);
93  gfan::ZMatrix equations = gfan::ZMatrix(0,n);
94  for (int i=0; i<IDELEMS(I); i++)
95  {
96  g = (poly) I->m[i];
97  if (g)
98  {
99  p_GetExpV(g,leadexpv,r);
100  leadexpw = intStar2ZVector(n,leadexpv);
101  pIter(g);
102  while (g)
103  {
104  p_GetExpV(g,tailexpv,r);
105  tailexpw = intStar2ZVector(n,tailexpv);
106  equations.appendRow(leadexpw-tailexpw);
107  pIter(g);
108  }
109  }
110  }
111  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
112  gfan::ZVector lowerHalfSpaceCondition = gfan::ZVector(n);
113  lowerHalfSpaceCondition[0] = -1;
114  inequalities.appendRow(lowerHalfSpaceCondition);
115 
116  omFreeSize(leadexpv,(n+1)*sizeof(int));
117  omFreeSize(tailexpv,(n+1)*sizeof(int));
118  return gfan::ZCone(inequalities,equations);
119 }
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:540
g
Definition: cfModGcd.cc:4031
#define omAlloc(size)
Definition: omAllocDecl.h:210
int int kStrategy strat if(h==NULL) return NULL
#define pIter(p)
Definition: monomials.h:44
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
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:543
polyrec * poly
Definition: hilb.h:10
BOOLEAN lowerHomogeneitySpace ( leftv  res,
leftv  args 
)

Definition at line 122 of file tropical.cc.

123 {
124  leftv u = args;
125  if ((u != NULL) && (u->Typ() == POLY_CMD))
126  {
127  leftv v = u->next;
128  if (v == NULL)
129  {
130  poly g = (poly) u->Data();
131  ideal I = idInit(1);
132  I->m[0] = g;
133  res->rtyp = coneID;
134  res->data = (void*) new gfan::ZCone(lowerHomogeneitySpace(I,currRing));
135  I->m[0] = NULL;
136  id_Delete(&I,currRing);
137  return FALSE;
138  }
139  }
140  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
141  {
142  leftv v = u->next;
143  if (v == NULL)
144  {
145  ideal I = (ideal) u->Data();
146  res->rtyp = coneID;
147  res->data = (void*) new gfan::ZCone(lowerHomogeneitySpace(I,currRing));
148  return FALSE;
149  }
150  }
151  WerrorS("lowerHomogeneitySpace: unexpected parameters");
152  return TRUE;
153 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
gfan::ZCone lowerHomogeneitySpace(ideal I, ring r)
Definition: tropical.cc:85
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
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
gfan::ZCone maximalGroebnerCone ( const ideal &  I,
const ring &  r 
)

Definition at line 291 of file tropical.cc.

292 {
293  int n = rVar(r);
294  poly g = NULL;
295  int* leadexpv = (int*) omAlloc((n+1)*sizeof(int));
296  int* tailexpv = (int*) omAlloc((n+1)*sizeof(int));
297  gfan::ZVector leadexpw = gfan::ZVector(n);
298  gfan::ZVector tailexpw = gfan::ZVector(n);
299  gfan::ZMatrix inequalities = gfan::ZMatrix(0,n);
300  for (int i=0; i<IDELEMS(I); i++)
301  {
302  g = (poly) I->m[i]; pGetExpV(g,leadexpv);
303  leadexpw = intStar2ZVector(n, leadexpv);
304  pIter(g);
305  while (g != NULL)
306  {
307  pGetExpV(g,tailexpv);
308  tailexpw = intStar2ZVector(n, tailexpv);
309  inequalities.appendRow(leadexpw-tailexpw);
310  pIter(g);
311  }
312  }
313  omFreeSize(leadexpv,(n+1)*sizeof(int));
314  omFreeSize(tailexpv,(n+1)*sizeof(int));
315  return gfan::ZCone(inequalities,gfan::ZMatrix(0, inequalities.getWidth()));
316 }
#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:540
g
Definition: cfModGcd.cc:4031
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define pIter(p)
Definition: monomials.h:44
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
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
#define NULL
Definition: omList.c:10
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
polyrec * poly
Definition: hilb.h:10
BOOLEAN maximalGroebnerCone ( leftv  res,
leftv  args 
)

Definition at line 319 of file tropical.cc.

320 {
321  leftv u = args;
322  if ((u != NULL) && (u->Typ() == POLY_CMD))
323  {
324  leftv v = u->next;
325  if (v == NULL)
326  {
327  try
328  {
329  poly g = (poly) u->Data();
330  ideal I = idInit(1);
331  I->m[0] = g;
332  res->rtyp = coneID;
333  res->data = (void*) new gfan::ZCone(maximalGroebnerCone(I,currRing));
334  I->m[0] = NULL;
335  id_Delete(&I,currRing);
336  return FALSE;
337  }
338  catch (const std::exception& ex)
339  {
340  Werror("ERROR: %s",ex.what());
341  return TRUE;
342  }
343  }
344  }
345  if ((u != NULL) && (u->Typ() == IDEAL_CMD))
346  {
347  leftv v = u->next;
348  if (v == NULL)
349  {
350  try
351  {
352  ideal I = (ideal) u->Data();
353  res->rtyp = coneID;
354  res->data = (void*) new gfan::ZCone(maximalGroebnerCone(I,currRing));
355  return FALSE;
356  }
357  catch (const std::exception& ex)
358  {
359  Werror("ERROR: %s",ex.what());
360  return TRUE;
361  }
362  }
363  }
364  WerrorS("maximalGroebnerCone: unexpected parameters");
365  return TRUE;
366 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:144
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
gfan::ZCone maximalGroebnerCone(const ideal &I, const ring &r)
Definition: tropical.cc:291
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
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void tropical_setup ( SModulFunctions p)

Definition at line 437 of file tropical.cc.

438 {
439  p->iiAddCproc("","groebnerCone",FALSE,groebnerCone);
440  p->iiAddCproc("","maximalGroebnerCone",FALSE,maximalGroebnerCone);
441  p->iiAddCproc("","homogeneitySpace",FALSE,homogeneitySpace);
442  p->iiAddCproc("","lowerHomogeneitySpace",FALSE,lowerHomogeneitySpace);
443  p->iiAddCproc("","initial",FALSE,initial);
444  p->iiAddCproc("","tropicalVariety",FALSE,tropicalVariety);
445  p->iiAddCproc("","groebnerFan",FALSE,groebnerFan);
446  p->iiAddCproc("","groebnerComplex",FALSE,groebnerComplex);
447 #ifndef NDEBUG
448  // p->iiAddCproc("","tropicalNeighbours",FALSE,tropicalNeighbours);
449  // p->iiAddCproc("","initial0",FALSE,initial0);
450  p->iiAddCproc("","pReduceDebug",FALSE,pReduceDebug);
451  // p->iiAddCproc("","ppreduceInitially0",FALSE,ppreduceInitially0);
452  // p->iiAddCproc("","ppreduceInitially1",FALSE,ppreduceInitially1);
453  // p->iiAddCproc("","ppreduceInitially2",FALSE,ppreduceInitially2);
454  p->iiAddCproc("","ptNormalize",FALSE,ptNormalize);
455  p->iiAddCproc("","ppreduceInitially3",FALSE,ppreduceInitially3);
456  // p->iiAddCproc("","ppreduceInitially4",FALSE,ppreduceInitially4);
457  // p->iiAddCproc("","ttpReduce",FALSE,ttpReduce);
458  // p->iiAddCproc("","ttreduceInitially0",FALSE,ttreduceInitially0);
459  // p->iiAddCproc("","ttreduceInitially1",FALSE,ttreduceInitially1);
460  // p->iiAddCproc("","ttreduceInitially2",FALSE,ttreduceInitially2);
461  // p->iiAddCproc("","ttreduceInitially3",FALSE,ttreduceInitially3);
462  // p->iiAddCproc("","ttreduceInitially4",FALSE,ttreduceInitially4);
463  // p->iiAddCproc("","checkForMonomial",FALSE,checkForMonomial);
464  // p->iiAddCproc("","dwr0",FALSE,dwr0);
465  // p->iiAddCproc("","witness0",FALSE,witness0);
466  // p->iiAddCproc("","tropicalVariety00",FALSE,tropicalVariety00);
467  // p->iiAddCproc("","tropicalVariety01",FALSE,tropicalVariety01);
468  // p->iiAddCproc("","tropicalCurve0",FALSE,tropicalCurve0);
469  // p->iiAddCproc("","tropicalCurve1",FALSE,tropicalCurve1);
470  p->iiAddCproc("","reduceInitiallyDebug",FALSE,reduceInitiallyDebug);
471  p->iiAddCproc("","computeWitnessDebug",FALSE,computeWitnessDebug);
472  p->iiAddCproc("","computeFlipDebug",FALSE,computeFlipDebug);
473  p->iiAddCproc("","flipConeDebug",FALSE,flipConeDebug);
474  // p->iiAddCproc("","groebnerNeighboursDebug",FALSE,groebnerNeighboursDebug);
475  // p->iiAddCproc("","tropicalNeighboursDebug",FALSE,tropicalNeighboursDebug);
476  p->iiAddCproc("","tropicalStarDebug",FALSE,tropicalStarDebug);
477  p->iiAddCproc("","tropicalStartingPoint",FALSE,tropicalStartingPoint);
478  p->iiAddCproc("","positiveTropicalStartingPoint",FALSE,positiveTropicalStartingPoint);
479  p->iiAddCproc("","nonNegativeTropicalStartingPoint",FALSE,nonNegativeTropicalStartingPoint);
480  p->iiAddCproc("","negativeTropicalStartingPoint",FALSE,negativeTropicalStartingPoint);
481  p->iiAddCproc("","nonPositiveTropicalStartingPoint",FALSE,nonPositiveTropicalStartingPoint);
482  p->iiAddCproc("","tropicalStartingCone",FALSE,tropicalStartingCone);
483 #endif //NDEBUG
484  // p->iiAddCproc("","ppreduceInitially",FALSE,ppreduceInitially);
485  // p->iiAddCproc("","ttreduceInitially",FALSE,ttreduceInitially);
486 }
BOOLEAN negativeTropicalStartingPoint(leftv res, leftv args)
BOOLEAN flipConeDebug(leftv res, leftv args)
gfan::ZCone homogeneitySpace(ideal I, ring r)
Definition: tropical.cc:19
BOOLEAN reduceInitiallyDebug(leftv res, leftv args)
gfan::ZFan * groebnerFan(const tropicalStrategy currentStrategy)
Definition: groebnerFan.cc:28
BOOLEAN positiveTropicalStartingPoint(leftv res, leftv args)
BOOLEAN nonPositiveTropicalStartingPoint(leftv res, leftv args)
#define FALSE
Definition: auxiliary.h:140
gfan::ZFan * groebnerComplex(const tropicalStrategy currentStrategy)
BOOLEAN computeFlipDebug(leftv res, leftv args)
groebnerCone tropicalStartingCone(const tropicalStrategy &currentStrategy)
BOOLEAN computeWitnessDebug(leftv res, leftv args)
gfan::ZCone lowerHomogeneitySpace(ideal I, ring r)
Definition: tropical.cc:85
gfan::ZCone maximalGroebnerCone(const ideal &I, const ring &r)
Definition: tropical.cc:291
BOOLEAN pReduceDebug(leftv res, leftv args)
BOOLEAN ppreduceInitially3(leftv res, leftv args)
BOOLEAN tropicalVariety(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, checking each cone whether it contains a ray in the tropical variety.
Definition: startingCone.cc:27
void ptNormalize(poly *gStar, const number p, const ring r)
BOOLEAN initial(leftv res, leftv args)
Definition: tropical.cc:369
BOOLEAN tropicalStarDebug(leftv res, leftv args)
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:73
BOOLEAN nonNegativeTropicalStartingPoint(leftv res, leftv args)

Variable Documentation

int tropicalVerboseLevel = 0

Definition at line 17 of file tropical.cc.