00001
00002
00014
00015
00016 #ifndef polybori_groebner_LexHelper_h_
00017 #define polybori_groebner_LexHelper_h_
00018
00019
00020 #include "groebner_defs.h"
00021 #include "IsEcart0Predicate.h"
00022 #include "ReductionStrategy.h"
00023 #include "nf.h"
00024
00025 BEGIN_NAMESPACE_PBORIGB
00026
00031 class LexHelper{
00032 public:
00033 static bool irreducible_lead(const Monomial& m, const ReductionStrategy& strat){
00034 if (strat.optRedTailDegGrowth) return PBORINAME::groebner::irreducible_lead(m,strat);
00035 else{
00036 BooleSet ms=strat.leadingTerms.intersect(m.divisors());
00037 if (ms.isZero())
00038 return true;
00039 else {
00040 return std::find_if(ms.expBegin(),ms.expEnd(),IsEcart0Predicate(strat))==ms.expEnd();
00041 }
00042 }
00043
00044 }
00045 static Polynomial::const_iterator begin(const Polynomial & p){
00046 return p.begin();
00047 }
00048 static Polynomial::const_iterator end(const Polynomial & p){
00049 return p.end();
00050 }
00051 static Polynomial nf(const ReductionStrategy& strat, const Polynomial& p, const Monomial& m){
00052
00053 if (strat.optRedTailDegGrowth) return nf3(strat,p,m);
00054 else return nf3_no_deg_growth(strat,p,m);
00055 }
00056 typedef Polynomial::const_iterator iterator_type;
00057 const static bool isDegreeOrder=false;
00058 const static bool isLexicographicalOrder=true;
00059 static bool knowRestIsIrreducible(const iterator_type& it, const ReductionStrategy & strat){
00060 if ( (it.deg()>0) && (it.firstIndex()>strat.reducibleUntil))
00061 return true;
00062 else return false;
00063
00064 }
00065 static Polynomial sum_range(std::vector<Monomial>& vec,const iterator_type&
00066 it, const iterator_type& end, Polynomial init){
00067 if (vec.size()==1) return vec[0];
00068 if (it!=end)
00069 return term_accumulate(it,end, init);
00070 else return init;
00071 }
00072 };
00073
00074 END_NAMESPACE_PBORIGB
00075
00076 #endif