synaps/mpol/Plex.h

00001 /*********************************************************************
00002 *      This file is part of the source code of SYNAPS kernel.        *
00003 *   Author(s): B. Mourrain, GALAAD, INRIA                            *
00004 **********************************************************************
00005 History: 
00006 $Id: Plex.h,v 1.1 2005/07/11 11:17:56 mourrain Exp $
00007 **********************************************************************/
00008 #ifndef SYNAPS_MPOL_PLEX_H
00009 #define SYNAPS_MPOL_PLEX_H
00010 
00011 #include <synaps/init.h>
00012 
00013 __BEGIN_NAMESPACE_SYNAPS
00014 
00015 
00019 struct Plex
00020 {
00021   template <class M>
00022   static bool less (const M &, const M &);
00023   template <class M>
00024   bool operator() (const M &, const M &) const {return less(m1,m2);}
00025 };
00026 
00027 template <class M>
00028 inline bool Plex::less(const M & m1, const M & m2) {
00029 
00030    int n1 = m1.nvars(), n2 =m2.nvars();
00031    std::cout<<">> "<<m1<<" "<<n1<<" "<<m2<<" "<<n2<<std::endl;
00032 
00033    int i = max(n1,n2);
00034 
00035    // if(n1 <0 && n2>0) return true;
00036    // if(n2 <0 && n1>0) return false;
00037 
00038    if(i <0)
00039      return false;
00040    else
00041      {
00042        while(m1[i] == m2[i] && i>=0) i--;
00043        return (m1[i]< m2[i]);
00044      }
00045 }
00046 
00047 __END_NAMESPACE_SYNAPS
00048 
00049 #endif // SYNAPS_MPOL_PLEX_H
00050 

SYNAPS DOCUMENTATION
logo