21
24
GroebnerConeApplication():
22
25
optionRestrict("--restrict","Add an inequality for each coordinate, so that the the cone is restricted to the non-negative orthant."),
23
26
optionPair("--pair","The Groebner cone is given by a pair of compatible Groebner bases. The first basis is for the initial ideal and the second for the ideal itself. See the tropical section of the manual."),
24
optionAsFan("--asfan","Writes the cone as a polyhedral fan with all its faces instead. In this way the extreme rays of the cone are also computed.")
27
optionAsFan("--asfan","Writes the cone as a polyhedral fan with all its faces instead. In this way the extreme rays of the cone are also computed."),
28
optionVectorInput("--vectorinput","Compute a cone given list of inequalities rather than a Groebner cone. The input is an integer which specifies the dimension of the ambient space, a list of inequalities given as vectors and a list of equations.")
31
35
return "_groebnercone";
36
PolynomialSet m=FileParser(Stdin).parsePolynomialSetWithRing();
37
PolynomialSet g(m.getRing());
38
if(optionPair.getValue())
40
IntegerVectorList equalities;
41
IntegerVectorList normals;
44
if(optionVectorInput.getValue())
40
g=FileParser(Stdin).parsePolynomialSet(m.getRing());
48
normals=P.parseIntegerVectorList();
49
equalities=P.parseIntegerVectorList();
45
m=g.markedTermIdeal();
47
int n=g.getRing().getNumberOfVariables();
49
IntegerVectorList equalities=wallInequalities(m);
50
IntegerVectorList normals=algebraicTest(wallInequalities(g),g);
51
if(optionRestrict.getValue())
54
normals.push_back(IntegerVector::standardVector(n,i));
57
// AsciiPrinter(Stderr).printVectorList(normals);
53
PolynomialSet m=FileParser(Stdin).parsePolynomialSetWithRing();
54
PolynomialSet g(m.getRing());
55
if(optionPair.getValue())
57
g=FileParser(Stdin).parsePolynomialSet(m.getRing());
62
m=g.markedTermIdeal();
66
//Check that markings are consistent
67
PolynomialSet M1=g.markedTermIdeal();
68
PolynomialSet M2=m.markedTermIdeal();
69
assert(M1.size()==M2.size());
70
PolynomialSet::const_iterator i1=M1.begin();
71
for(PolynomialSet::const_iterator i2=M2.begin();i2!=M2.end();i1++,i2++)
73
assert((*i1-*i2).isZero());
77
n=g.getRing().getNumberOfVariables();
79
equalities=wallInequalities(m);
80
normals=(wallInequalities(g));
81
if(optionRestrict.getValue())
84
normals.push_back(IntegerVector::standardVector(n,i));
91
FieldMatrix A=integerMatrixToFieldMatrix(rowsToIntegerMatrix(equalities,n),Q);
94
equalities=IntegerVectorList();
95
for(int i=0;i<A.getHeight();i++)
96
equalities.push_back(A[i].primitive());
98
set<IntegerVector> newInequalities;
99
for(IntegerVectorList::const_iterator i=normals.begin();i!=normals.end();i++)
100
newInequalities.insert(A.canonicalize(integerVectorToFieldVector(*i,Q)).primitive());
102
normals=IntegerVectorList();
103
for(set<IntegerVector>::const_iterator i=newInequalities.begin();i!=newInequalities.end();i++)
104
normals.push_back(*i);
108
log1 fprintf(Stderr,"Inequalities");
109
log1 AsciiPrinter(Stderr).printVectorList(normals);
110
log1 fprintf(Stderr,"Equations");
111
log1 AsciiPrinter(Stderr).printVectorList(equalities);
59
113
PolyhedralCone c(normals,equalities,n);
66
120
IntegerVectorList empty;
67
121
HalfOpenCone C(n,c.getEquations(),c.getHalfSpaces(),empty,true);
68
122
// PolyhedralFan F=faceComplexOfCone(C);
69
PolyhedralFan F(n);F.insert(C.closure());
70
F.printWithIndices(&P,false,0);
123
PolyhedralCone C2=C.closure();
125
PolyhedralFan F(n);F.insert(C2);
126
F.printWithIndices(&P,FPF_default);
127
// F.printWithIndices(&P,false,0,false,false,optionXml.getValue());