Borderbasix

Dlex.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: Dlex.hpp,v 1.1.1.1 2006/10/06 08:01:40 trebuche Exp $
7 **********************************************************************/
8 #ifndef _Dlex_H_
9 #define _Dlex_H_
10 
19 template <class M> struct Dlex
20 {
21  static bool less (const M &, const M &);
22  bool operator() (const M &, const M &);
23 };
24 
25 template <class M>
26 bool
27 Dlex<M>::less (const M & m1, const M & m2) {
28  int n1 = m1.Lvar(), n2 =m2.Lvar();
29  if(n1 <0 && n2>0) return false;
30  if(n2 <0 && n1>0) return true;
31  if (Degree(m1) < Degree(m2) ) return false;
32  else if (Degree(m1) > Degree(m2)) return true;
33  else {
34  int n = std::max(n1,n2);
35  int i = std::max(n,0);
36  while(i>=0 && m1[i] == m2[i]) i--;
37  if(i <0) return false;
38  else
39  return (m1[i]> m2[i]);
40  }
41 }
42 
43 template <class M>
44 bool
45 Dlex<M>::operator() (const M & m1, const M & m2) {
46  return less(m1,m2);
47 }
48 
49 template <class T1,class T2>
50 bool
51 operator< (const Monom<T1,T2> & m1, const Monom<T1,T2> & m2) {
52  return Dlex<Monom<T1,T2> >::less(m1,m2);
53 }
54 
55 #endif // //_Dlex_H_
#define max(a, b)
Definition: alp_f2c.H:167
static bool less(const M &, const M &)
Definition: Dlex.hpp:27
dynamicexp< X, E >::degree_t Degree(const dynamicexp< X, E > &t)
Definition: dynamicexp.hpp:91
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
Definition: Dlex.hpp:19
Multivariate monomials.
Definition: Monom.hpp:21
bool operator()(const M &, const M &)
Definition: Dlex.hpp:45
Home  |  Download & InstallContributions