My Project
Loading...
Searching...
No Matches
groebnerComplex.cc
Go to the documentation of this file.
1#include "misc/options.h"
2#include "bbfan.h"
3
4#include "groebnerCone.h"
5#include "startingCone.h"
6#include "groebnerFan.h"
7#include "tropicalTraversal.h"
8
10
11gfan::ZFan* groebnerComplex(const tropicalStrategy currentStrategy)
12{
13 groebnerCone startingCone = groebnerStartingCone(currentStrategy);
16}
17
18
20{
21 leftv u = args;
22 if ((u!=NULL) && (u->Typ()==IDEAL_CMD))
23 {
24 ideal I = (ideal) u->Data();
25 leftv v = u->next;
26 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
27 {
28 leftv w = v->next;
29 if (w==NULL)
30 {
31 number p = (number) v->Data();
32 tropicalStrategy currentStrategy(I,p,currRing);
33 if ((I->m[0]!=NULL) && (idElem(I)==1))
34 {
35 try
36 {
37 ideal startingIdeal = currentStrategy.getStartingIdeal();
38 ring startingRing = currentStrategy.getStartingRing();
39 currentStrategy.pReduce(startingIdeal,startingRing);
40 poly g = startingIdeal->m[0];
41 pReduceInhomogeneous(g, currentStrategy.getUniformizingParameter(), startingRing);
42 gfan::ZFan* zf = groebnerFanOfPolynomial(g,startingRing,true);
43 res->rtyp = fanID;
44 res->data = (char*) zf;
45 return FALSE;
46 }
47 catch (const std::exception& ex)
48 {
49 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
50 return TRUE;
51 }
52 }
53 else
54 {
55 try
56 {
57 gfan::ZFan* zf = groebnerComplex(currentStrategy);
58 res->rtyp = fanID;
59 res->data = (char*) zf;
60 return FALSE;
61 }
62 catch (const std::exception& ex)
63 {
64 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
65 return TRUE;
66 }
67 }
68 }
69 }
70 }
71 if ((u!=NULL) && (u->Typ()==POLY_CMD))
72 {
73 poly g = (poly) u->Data();
74 leftv v = u->next;
75 if ((v!=NULL) && (v->Typ()==NUMBER_CMD))
76 {
77 leftv w = v->next;
78 if (w==NULL)
79 {
80 try
81 {
82 number p = (number) v->Data();
83 ideal I = idInit(1);
84 I->m[0] = p_Copy(g,currRing);
85 tropicalStrategy currentStrategy(I,p,currRing);
86 ideal startingIdeal = currentStrategy.getStartingIdeal();
87 ring startingRing = currentStrategy.getStartingRing();
88 poly gg = startingIdeal->m[0];
89 pReduceInhomogeneous(gg, currentStrategy.getUniformizingParameter(), startingRing);
90 gfan::ZFan* zf = groebnerFanOfPolynomial(gg,startingRing,true);
92 res->rtyp = fanID;
93 res->data = (char*) zf;
94 return FALSE;
95 }
96 catch (const std::exception& ex)
97 {
98 WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
99 return TRUE;
100 }
101 }
102 }
103 }
104 WerrorS("groebnerComplex: unexpected parameters");
105 return TRUE;
106}
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
VAR int fanID
Definition: bbfan.cc:19
gfan::ZFan * toFanStar(std::set< gfan::ZCone > setOfCones)
int p
Definition: cfModGcd.cc:4078
g
Definition: cfModGcd.cc:4090
Variable next() const
Definition: variable.h:52
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1019
void * Data()
Definition: subexpr.cc:1162
leftv next
Definition: subexpr.h:86
void pReduce(ideal I, const ring r) const
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
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
@ NUMBER_CMD
Definition: grammar.cc:288
@ POLY_CMD
Definition: grammar.cc:289
gfan::ZFan * groebnerComplex(const tropicalStrategy currentStrategy)
implementation of the class groebnerCone
std::set< groebnerCone, groebnerCone_compare > groebnerCones
Definition: groebnerCone.h:24
gfan::ZFan * groebnerFanOfPolynomial(poly g, ring r, bool onlyLowerHalfSpace=false)
Definition: groebnerFan.cc:36
#define NULL
Definition: omList.c:12
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void pReduceInhomogeneous(poly &g, const number p, const ring r)
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
static int idElem(const ideal F)
number of non-zero polys in F
Definition: simpleideals.h:67
groebnerCone groebnerStartingCone(const tropicalStrategy &currentStrategy)
Definition: startingCone.cc:21
groebnerCones groebnerTraversal(const groebnerCone startingCone)
BOOLEAN tropicalVariety(leftv res, leftv args)