Borderbasix

Vlex.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * This file is part of the source code of BORDERBASIX software. *
3 * (C) B. Mourrain, INRIA *
4 **********************************************************************
5 History:
6 $Id: Vlex.hpp,v 1.1.1.1 2006/10/06 08:01:40 trebuche Exp $
7 **********************************************************************/
8 #ifndef _Vlex_H_
9 #define _Vlex_H_
10 
19 template <class M> struct Vlex {
20  static bool less(const M &, const M &);
21  bool operator() (const M &, const M &);
22 };
23 
24 template <class M>
25 bool Vlex<M>::less(const M & m1, const M & m2) {
26  int d1,d2;
27  int n1 = m1.Lvar(), n2 =m2.Lvar();
28  int n = max(n1,n2);
29 
30  if(n1 <0 && n2>0) return false;
31  if(n2 <0 && n1>0) return true;
32  if (m1.GetDegree() < m2.GetDegree()) return false;
33  else if (m1.GetDegree() > m2.GetDegree()) return true;
34  else {
35  int i=n;
36  while( m1.GetDegree(i) == m2.GetDegree(i) && i>=0) i--;
37  if(i <0)
38  return false;
39  else
40  return (m1.GetDegree(i)> m2.GetDegree(i));
41  }
42 }
43 
44 template <class M>
45 bool Dlex<M>::operator()(const M & m1, const M & m2) {
46  return less(m1,m2);
47 }
48 
49 //template <class M>
50 //bool operator<(const M & m1, const M & m2) {return Vlex<M>::less(m1,m2);}
51 
52 #endif // _Vlex_H_
53 
#define max(a, b)
Definition: alp_f2c.H:167
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
bool operator()(const M &, const M &)
Definition: Dlex.hpp:45
bool operator()(const M &, const M &)
Definition: Vlex.hpp:19
static bool less(const M &, const M &)
Definition: Vlex.hpp:25
Home  |  Download & InstallContributions