165
180
PolynomialSet guessInitialIdealWithoutMonomial(PolynomialSet const &groebnerBasis, PolynomialSet *fullNeighbourBasis, bool onlyCheckRays) //ideal must be homogeneous
166
181
// fullNeighbourBasis is set to a Groebner basis of the full ideal. The returned basis and fullNeighbourBasis have at least one termorder in common
183
// log0 fprintf(Stderr,"A\n");
168
184
assert(groebnerBasis.isValid());
185
// log0 fprintf(Stderr,"B\n");
169
186
if(fullNeighbourBasis)
171
188
assert(fullNeighbourBasis->isValid());
190
// log0 fprintf(Stderr,"C\n");
174
192
int n=groebnerBasis.numberOfVariablesInRing();
193
// log0 fprintf(Stderr,"D\n");
175
194
int h=dimensionOfHomogeneitySpace(groebnerBasis);
195
// log0 fprintf(Stderr,"E\n");
176
196
int d=krullDimension(groebnerBasis);
197
// log0 fprintf(Stderr,"F\n");
219
237
fprintf(Stderr,"Max dimension: %i\n",f.getMaxDimension());
220
238
f=refinement(f,PolyhedralFan::bergmanOfPrincipalIdeal(*i));
221
239
f.removeAllExcept(3);
223
241
IntegerVectorList l=f.getRelativeInteriorPoints();
226
244
PolynomialSet r=checkList(l,groebnerBasis,fullNeighbourBasis,h,result, onlyCheckRays);
227
245
if(result)return r;
229
fprintf(Stderr,"UNABLE TO COMPUTE STARTING CONE.\n");
230
assert(0); // We could not guess an intial ideal
248
return groebnerBasis;
251
static PolynomialSet checkListStably(IntegerVectorList const &l, PolynomialSet const &groebnerBasis, PolynomialSet *fullNeighbourBasis, int h, bool &result, bool onlyCheckRays)
253
debug<< "Checklist called on"<<groebnerBasis;
254
for(IntegerVectorList::const_iterator i=l.begin();i!=l.end();i++)
256
WeightReverseLexicographicTermOrder t(*i);
257
log2 fprintf(Stderr,"Taking initial forms with respect to:");
258
log2 AsciiPrinter(Stderr).printVector(*i);
259
log2 fprintf(Stderr,"\n");
260
PolynomialSet h2=groebnerBasis;
261
log2 fprintf(Stderr,"Done computing Gr\"obner basis.\n");
263
log3 AsciiPrinter(Stderr).printPolynomialSet(h2);
264
PolynomialSet wall=initialForms(h2,*i);
266
log3 AsciiPrinter(Stderr).printString("Initial ideal:\n");
267
log3 AsciiPrinter(Stderr).printPolynomialSet(wall);
269
int hdim2=dimensionOfHomogeneitySpace(wall);
272
if(nonEmptyStableIntersection(wall))
274
log1 fprintf(Stderr,"Iterating recursively.\n");
275
//PolynomialSet initialIdeal=guessInitialIdealWithoutMonomial(wall,0);
276
PolynomialSet initialIdeal=guessInitialIdealWithoutMonomialStably(wall,fullNeighbourBasis,onlyCheckRays);
278
if(fullNeighbourBasis)
280
//*fullNeighbourBasis=liftBasis(initialIdeal,h2);
281
// *fullNeighbourBasis=liftBasis(*fullNeighbourBasis,h2);
282
*fullNeighbourBasis=groebnerBasis;
283
fullNeighbourBasis->copyMarkings(initialIdeal);
293
return groebnerBasis;
296
PolynomialSet guessInitialIdealWithoutMonomialStably(PolynomialSet const &groebnerBasis, PolynomialSet *fullNeighbourBasis, bool onlyCheckRays) //ideal must be homogeneous
297
// fullNeighbourBasis is set to a Groebner basis of the full ideal. The returned basis and fullNeighbourBasis have at least one termorder in common
299
int n=groebnerBasis.numberOfVariablesInRing();
300
int h=dimensionOfHomogeneitySpace(groebnerBasis);
301
int d=n-groebnerBasis.size();//krullDimension(groebnerBasis);
303
debug<</*"d"<<d<<*/"h"<<h<<"n"<<n<<"\n";
308
if(fullNeighbourBasis)*fullNeighbourBasis=groebnerBasis;
309
return groebnerBasis;
313
log2 fprintf(Stderr,"Computing extreme rays.\n");
314
//IntegerVectorList a;
315
PolyhedralCone p=coneFromMarkedBasis(groebnerBasis);
316
//PolyhedralCone p=PolyhedralCone(wallInequalities(groebnerBasis),a);
317
IntegerVectorList extreme=p.extremeRays();
318
log2 fprintf(Stderr,"Extreme rays of Groebner cone:\n");
319
log2 AsciiPrinter(Stderr).printVectorList(extreme);
322
PolynomialSet r=checkListStably(extreme,groebnerBasis,fullNeighbourBasis,h,result, onlyCheckRays);
325
if(onlyCheckRays)startingConeError();
327
PolyhedralFan f=PolyhedralFan::fullSpace(n);
329
int hypersurfacesToGo=groebnerBasis.size();
330
for(PolynomialSet::const_iterator i=groebnerBasis.begin();i!=groebnerBasis.end();i++)
332
fprintf(Stderr,"Hypersurfaces to go:%i\n",hypersurfacesToGo--);
333
fprintf(Stderr,"Max dimension: %i\n",f.getMaxDimension());
334
f=refinement(f,PolyhedralFan::bergmanOfPrincipalIdeal(*i));
335
f.removeAllExcept(3);
337
IntegerVectorList l=f.getRelativeInteriorPoints();
340
PolynomialSet r=checkListStably(l,groebnerBasis,fullNeighbourBasis,h,result, onlyCheckRays);
231
344
return groebnerBasis;