Degree Reverse Lexicographic monomial ordering. More...
#include <monomial_ordering.hpp>
Degree Reverse Lexicographic monomial ordering.
Definition at line 38 of file monomial_ordering.hpp.
bool less | ( | const int * | m1, | |
int | s1, | |||
const int * | m2, | |||
int | s2 | |||
) | const [virtual] |
Implements MonomialOrdering.
Definition at line 8 of file monomial_ordering.cpp.
00008 { 00009 00010 int d1=0, d2=0; 00011 for(int i=0;i<n1;i++) d1+=m1[i]; 00012 for(int i=0;i<n2;i++) d2+=m2[i]; 00013 00014 // std::cout<< "less d1:= "<<d1<<std::endl; 00015 // std::cout<< "less d2:= "<<d2<<std::endl; 00016 if (d1 < d2 ) return true; 00017 else if (d1 > d2) return false; 00018 else { 00019 // if(n1 <=0 && n2>0) return false; 00020 // if(n1 <=0 && n2<=0) return false; 00021 // if(n2 <=0 && n1>0) return true; 00022 int n = (n1>n2?n1:n2); 00023 // std::cout<< "less n:= "<<n<<std::endl; 00024 int i; 00025 for(i = (n>0?n:0); i>=0 && (i<n1?m1[i]:0) == (i<n2?m2[i]:0);i--); 00026 // std::cout<< "less i:= "<<i<<std::endl; 00027 if(i < 0) 00028 return false; 00029 else 00030 return ((i<n1?m1[i]:0) > (i<n2?m2[i]:0)); 00031 } 00032 }