Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

powerprod.H

Go to the documentation of this file.
00001 
00008 #ifndef _POWERPROD_H_
00009 #define _POWERPROD_H_
00010 
00011 #include "tables.H"
00012 #include <iostream>
00013 #include <fstream>
00014 #include <sstream>
00015 #include <string>
00016 #include <iomanip>
00017 #include "alphabet.H"
00018 using namespace std;
00019 
00020 
00022 
00038 #define LEX 1
00039 #define LEXSV 101 // SV is for super-variable
00040 #define DEGLEX 2
00041 #define DEGLEXSV 102
00042 #define DEGREVLEX 3
00043 #define DEGREVLEXSV 103
00044 
00046 
00050 class PowProd {
00051 private:
00053   static Alphabet *alphabet;
00055   static AutoAlphabet default_alphabet;
00057   static int order;
00058 
00059 public:
00061   Tuple<long> powers;
00062 
00063 
00064 
00065   // constructors **************************
00066   // ***************************************
00067 
00068   PowProd();
00069   PowProd(long var_num);
00070   PowProd(long var_num, long thepower);
00071   PowProd(const PowProd& that);
00072 
00073   void debug() const {
00074     cout << powers << endl;
00075   }
00076 
00077   bool is_correct() const {
00078     return powers.size() == 0 || powers[ powers.size()-1 ] != 0 ;
00079   }
00080 
00081   // info **********************************
00082   // ***************************************
00083 
00085   long nvars() const;
00087   long degree() const;
00089   long power_of(long i) const;
00090  
00091   PowProd& operator=(const PowProd& that);
00092   PowProd& operator*=(const PowProd& that);
00093   PowProd operator*( const PowProd& that)  const ;
00094 
00095   // all about the order relation ********************
00096   // *************************************************
00097 
00098   bool lex_lessthan(const PowProd& that) const;
00099   bool lexsv_lessthan(const PowProd& that, long sv) const;
00100   bool deglex_lessthan(const PowProd& that) const;
00101   bool deglexsv_lessthan(const PowProd& that, long sv) const;
00102   bool degrevlex_lessthan(const PowProd& that) const;
00103   bool degrevlexsv_lessthan(const PowProd& that, long sv) const;
00105 
00110   bool operator<(const PowProd& that)  const;
00112   static void use_order(int theorder);
00114   static int current_order();
00116   friend bool powprod_compare(const PowProd& one, const PowProd& two, int order, long priority);
00118   bool operator==(const PowProd& that) const;
00119 
00120   // some arithmetic ****************************
00121   // ********************************************
00122 
00124   bool divides(const PowProd& that) const;
00126   PowProd& operator/=(const PowProd& that);
00127   PowProd operator/(const PowProd& that) const;
00128   bool prime_to(const PowProd& that) const;
00130   friend PowProd lcm(const PowProd& a, const PowProd& b);
00131 
00132   
00133   // some ad-hoc manipulations *****************
00134   // *******************************************
00135 
00137   void swap(long i, long j);
00139   void shift(long n);
00140 
00141   // display -- alphabets **********************
00142   // *******************************************
00143 
00144   // a bunch of static methods related to the alphabet mechanism
00145   static Alphabet* get_current_alphabet();
00146   static Alphabet* get_default_alphabet();
00148   static void set_alphabet(Alphabet *thealphabet);
00150 
00156   friend ostream& operator<<(ostream& os, const PowProd& P);
00157   friend ofstream& operator<<(ofstream& file, PowProd& x);
00158   friend void operator>>(ifstream& file, PowProd& x);
00159 
00160 };
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 #endif

Generated on Wed Jun 18 17:22:40 2008 for Pierre Guillot by  doxygen 1.3.9.1