realroot_doc 0.1.1
DegRevLex Struct Reference

Degree Reverse Lexicographic monomial ordering. More...

#include <monomial_ordering.hpp>

Inheritance diagram for DegRevLex:
MonomialOrdering

List of all members.

Public Member Functions


Detailed Description

Degree Reverse Lexicographic monomial ordering.

Definition at line 37 of file monomial_ordering.hpp.


Member Function Documentation

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.

                                                                         {
    
    int d1=0, d2=0;
    for(int i=0;i<n1;i++) d1+=m1[i];
    for(int i=0;i<n2;i++) d2+=m2[i];
  
    //    std::cout<< "less d1:= "<<d1<<std::endl;
    //    std::cout<< "less d2:= "<<d2<<std::endl;
    if (d1 < d2 ) return true;
    else if (d1 > d2) return false;
    else {
      //     if(n1 <=0 && n2>0) return false;
      //     if(n1 <=0 && n2<=0) return false;
      //     if(n2 <=0 && n1>0) return true;
     int n = (n1>n2?n1:n2); 
     //     std::cout<< "less n:= "<<n<<std::endl;
     int i;
     for(i = (n>0?n:0); i>=0 && (i<n1?m1[i]:0) == (i<n2?m2[i]:0);i--);
     //     std::cout<< "less i:= "<<i<<std::endl;
     if(i < 0) 
       return false;
     else 
       return ((i<n1?m1[i]:0) > (i<n2?m2[i]:0));
   }
  }

The documentation for this struct was generated from the following files: