CoCoALib-0.9905 date: 23 May 2007


PPMonoid.H

Go to the documentation of this file.
00001 #ifndef CoCoA_PPMonoid_H
00002 #define CoCoA_PPMonoid_H
00003 
00004 //   Copyright (c)  2005  John Abbott
00005 
00006 //   This file is part of the source of CoCoALib, the CoCoA Library.
00007 
00008 //   CoCoALib is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License (version 2)
00010 //   as published by the Free Software Foundation.  A copy of the full
00011 //   licence may be found in the file COPYING in this directory.
00012 
00013 //   CoCoALib is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //   GNU General Public License for more details.
00017 
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with CoCoA; if not, write to the Free Software
00020 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 
00023 #include "CoCoA/PPOrdering.H"
00024 #include "CoCoA/SmartPtrIRC.H"
00025 
00026 #include <cstddef>
00027 // using std::size_t;
00028 #include <iosfwd>
00029 // using std::ostream;
00030 #include <vector>
00031 // using std::vector;
00032 
00033 
00034 namespace CoCoA
00035 {
00036 
00037   class DivMask;        // forward declaration -- defined in DivMask.H
00038   class DivMaskRule;    // forward declaration -- defined in DivMask.H
00039   class OpenMathOutput; // forward declaration -- defined in OpenMath.H
00040   class ZZ;             // forward declaration -- defined in ZZ.H
00041   class degree;         // forward declaration -- defined in degree.H
00042   class symbol;         // forward declaration -- defined in symbol.H
00043 
00044   class PPMonoidBase; // forward declaration for SmartPtrIRC
00045   /*-----------------------------------------------------------------*/
00046   /** \include PPMonoid.txt  */
00047   /*-----------------------------------------------------------------*/
00048   class PPMonoid
00049   {
00050   public:
00051     explicit PPMonoid(const PPMonoidBase* ptr): mySmartPtr(ptr) {}
00052     // assignment disabled because SmartPtrIRC has no assignment
00053     const PPMonoidBase* operator->() const { return mySmartPtr.operator->(); }  ///< Allow const member fns to be called.
00054     bool operator==(const PPMonoid& PPM) const { return mySmartPtr==PPM.mySmartPtr; }
00055   private: // data members
00056     SmartPtrIRC<const PPMonoidBase> mySmartPtr;
00057   };
00058 
00059 
00060   // These two classes are simply wrapped void*
00061 
00062   class PPMonoidElemConstRawPtr
00063   {
00064   public:
00065     explicit PPMonoidElemConstRawPtr(void const* ptr): myPtr(const_cast<void*>(ptr)) {}
00066     // default copy ctor, assignment, and dtor are fine
00067     bool operator==(const PPMonoidElemConstRawPtr& pp) const;
00068     bool operator!=(const PPMonoidElemConstRawPtr& pp) const;
00069     void const* myRawPtr() const { return myPtr; }
00070   protected: // data member
00071     void* myPtr;
00072   };
00073 
00074   class PPMonoidElemRawPtr: public PPMonoidElemConstRawPtr
00075   {
00076     // NB data members are inherited from PPMonoidElemConstRawPtr
00077   public:
00078     explicit PPMonoidElemRawPtr(void* ptr): PPMonoidElemConstRawPtr(ptr) {}
00079     // default copy ctor, assignment, and dtor are fine
00080     void* myRawPtr() { return myPtr; }
00081   };
00082 
00083 
00084   //---------------------------------------------------------------------------
00085   // The next three classes mimic the trio of PPMonoidElem classes.
00086   class ConstRefPPMonoidElem
00087   {
00088   protected: // data members
00089     const PPMonoid myPPM;
00090     PPMonoidElemRawPtr const myPPPtr;  ///< VALUE NOT OWNED BY ME, deliberately NOT PPMonoidElemConstRawPtr
00091 
00092     // friend accessor functions (with non-member-fn syntax)
00093     friend PPMonoidElemConstRawPtr raw(const ConstRefPPMonoidElem& pp);
00094     friend const PPMonoid& owner(const ConstRefPPMonoidElem& pp);
00095 
00096   public:
00097     ConstRefPPMonoidElem(const PPMonoid& PPM, PPMonoidElemConstRawPtr rawpp);
00098     // default copy ctor works OK
00099     // default dtor works OK -- deliberately NOT virtual (see documentation)
00100   private: // disable assignment
00101     ConstRefPPMonoidElem& operator=(const ConstRefPPMonoidElem& rhs); ///< NEVER DEFINED -- assignment disabled
00102   };
00103 
00104 
00105   class RefPPMonoidElem: public ConstRefPPMonoidElem
00106   {
00107   protected: // data members inherited from ConstRefPPMonoidElem
00108     // friend accessor functions (with non-member-fn syntax)
00109     friend PPMonoidElemRawPtr raw(RefPPMonoidElem& pp);
00110 
00111   public:
00112     RefPPMonoidElem(const PPMonoid& PPM, PPMonoidElemRawPtr rawpp);
00113     // default copy ctor works OK
00114     // default dtor works OK  -- deliberately NOT virtual (see documentation)
00115     RefPPMonoidElem& operator=(const RefPPMonoidElem& rhs);
00116     RefPPMonoidElem& operator=(const ConstRefPPMonoidElem& rhs);
00117   };
00118 
00119 
00120 
00121 //   class PPMonoidElem; // fwd decl for friend decl.
00122 //   class PPMonoidElemCheckVecSize
00123 //   {
00124 //     friend class PPMonoidElem;
00125 //     PPMonoidElemCheckVecSize() {};
00126 //     PPMonoidElemCheckVecSize(std::size_t NumIndets, std::size_t VecSize) { if (VecSize != NumIndets) CoCoA_ERROR(ERR::BadArraySize, "PPMonoidElem(PPM,ExpVec)"); };
00127 //   };
00128 
00129   class PPMonoidElem: public RefPPMonoidElem
00130   {
00131     // NB data members inherited from ConstRefPPMonoidElem via RefPPMonoidElem
00132   public:
00133     explicit PPMonoidElem(const PPMonoid& Gamma);
00134     PPMonoidElem(const PPMonoid& Gamma, const std::vector<long>& v);
00135 //NYI    PPMonoidElem(const PPMonoid& Gamma, const std::vector<ZZ>& v);
00136     PPMonoidElem(const PPMonoid& Gamma, PPMonoidElemRawPtr rawToBeOwned);
00137     PPMonoidElem(const PPMonoidElem& copy);
00138     PPMonoidElem(const ConstRefPPMonoidElem& copy);
00139     PPMonoidElem& operator=(const PPMonoidElem& rhs);
00140     PPMonoidElem& operator=(const ConstRefPPMonoidElem& rhs);
00141     ~PPMonoidElem();  ///< deliberately NOT virtual (see documentation)
00142   };
00143 
00144 
00145   //---------------------------------------------------------------------------
00146   //  class PPMonoidBase /* ABSTRACT CLASS */
00147   class PPMonoidBase: protected IntrusiveReferenceCount  /* ABSTRACT CLASS */
00148   {
00149     friend class SmartPtrIRC<const PPMonoidBase>; ///< morally "friend PPMonoid", so it can alter reference count
00150 
00151   protected:
00152     PPMonoidBase(const PPOrdering& ord);
00153     virtual ~PPMonoidBase() {};
00154   private: // disable copy ctor and assignment
00155     PPMonoidBase(const PPMonoidBase& copy);       ///< NEVER DEFINED -- disable default copy ctor
00156     PPMonoidBase& operator=(const PPMonoidBase&); ///< NEVER DEFINED -- disable assignment
00157 
00158   public:
00159     typedef PPMonoidElemRawPtr RawPtr;           ///< just to save typing
00160     typedef PPMonoidElemConstRawPtr ConstRawPtr; ///< just to save typing
00161 
00162     const PPOrdering& myOrdering() const;
00163     virtual std::size_t myNumIndets() const = 0;                               ///< std::vector whose n-th entry is n-th indet as PPMonoidElem
00164     virtual const std::vector<PPMonoidElem>& myIndets() const = 0;
00165     virtual void mySymbols(std::vector<symbol>& SymList) const = 0;            ///< appends PPM's symbols to SymList
00166     virtual const symbol& myIndetName(std::size_t var) const = 0;              ///< the symbol of the var-th indet
00167 
00168     virtual const PPMonoidElem& myOne() const = 0;
00169     virtual PPMonoidElemRawPtr myNew() const = 0;                              ///< ctor from nothing
00170     virtual PPMonoidElemRawPtr myNew(PPMonoidElemConstRawPtr rawpp) const = 0;    ///< ctor from another pp
00171     virtual PPMonoidElemRawPtr myNew(const std::vector<long>& v) const = 0;    ///< ctor from exp vector
00172     PPMonoidElemRawPtr myNewCheckVecSize(const std::vector<long>& v) const;    ///< ctor from exp vector
00173 //NYI    virtual PPMonoidElemRawPtr myNew(const std::vector<ZZ>& v) const = 0;     ///< ctor from exp vector
00174 
00175     virtual void myDelete(RawPtr rawpp) const = 0;                                ///< dtor, frees pp
00176     virtual void mySwap(RawPtr rawpp1, RawPtr rawpp2) const = 0;                     ///< swap(pp1, pp2)
00177     virtual void myAssignOne(RawPtr rawpp) const = 0;                             ///< pp = 1
00178     virtual void myAssign(RawPtr rawpp, ConstRawPtr rawpp1) const = 0;               ///< pp = pp1
00179     virtual void myAssign(RawPtr rawpp, const std::vector<long>& v) const = 0;    ///< pp = v (assign from exp vector)
00180     virtual void myMul(RawPtr rawpp, ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0; ///< pp = pp1*pp2
00181     virtual void myMulIndetPower(RawPtr rawpp, std::size_t var, unsigned long exp) const = 0;///< pp *= indet(var)^exp
00182     virtual void myDiv(RawPtr rawpp, ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0; ///< pp = pp1/pp2
00183     virtual void myColon(RawPtr rawpp, ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0;///< pp = pp1/gcd(pp1,pp2)
00184     virtual void myGcd(RawPtr rawpp, ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0; ///< pp = gcd(pp1,pp2)
00185     virtual void myLcm(RawPtr rawpp, ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0; ///< pp = lcm(pp1,pp2)
00186     void myPower(RawPtr rawpp, ConstRawPtr rawpp1, unsigned long exp) const;         ///< pp = pp1^exp
00187     void myPower(RawPtr rawpp, ConstRawPtr rawpp1, const ZZ& EXP) const;             ///< pp = pp1^EXP,  with EXP >= 0
00188     virtual void myPowerSmallExp(RawPtr rawpp, ConstRawPtr rawpp1, unsigned long exp) const = 0;// pp = pp1^exp (non-trivial)
00189     virtual void myPowerBigExp(RawPtr rawpp, ConstRawPtr rawpp1, const ZZ& EXP) const; ///< pp = pp1^EXP (non-triv, EXP large); default gives error
00190 
00191     virtual bool myIsOne(ConstRawPtr rawpp) const = 0;                            ///< is pp = 1?
00192     virtual bool myIsIndet(std::size_t& index, ConstRawPtr rawpp) const = 0;      ///< true iff pp is an indet
00193     virtual bool myIsIndetPower(std::size_t& index, ZZ& EXP, ConstRawPtr rawpp) const; ///< true iff pp is a power of an indet
00194     virtual bool myIsCoprime(ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0;      ///< are pp1, pp2 coprime?
00195     virtual bool myIsEqual(ConstRawPtr rawpp1, ConstRawPtr rawpp2) const;            ///< is pp1 equal to pp2?
00196     virtual bool myIsDivisible(ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0;    ///< is pp1 divisible by pp2?
00197 
00198     virtual int myCmp(ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0;             ///< <0, =0, >0 as pp1 < = > pp2
00199     //    virtual int myHomogCmp(ConstRawPtr rawt1, ConstRawPtr rawt2) const = 0;   ///< <0, =0, >0 as t1 < = > t2 assuming t1 and t2 have same multi-degree
00200     //    virtual int myHomogDegRevLex(ConstRawPtr rawt1, ConstRawPtr rawt2) const = 0; ///< <0, =0, >0 as t1 < = > t2 ??? degrevlex assuming t1 and t2 have same multi-degree TO BE REMOVED
00201 
00202     virtual std::size_t myStdDeg(ConstRawPtr rawpp) const = 0;                    ///< standard degree of pp
00203     virtual void myWDeg(degree& d, ConstRawPtr rawpp) const = 0;                  ///< d = grading(pp)
00204     virtual int myCmpWDeg(ConstRawPtr rawpp1, ConstRawPtr rawpp2) const = 0;         ///< <0, =0, >0 as wdeg(pp1) < = > wdeg(pp2)
00205     virtual long myLog(ConstRawPtr rawpp, std::size_t var) const = 0;             ///< degree of pp in var
00206     virtual void myZZLog(ZZ& EXP, ConstRawPtr rawpp, std::size_t var) const = 0;  ///< EXP = degree of pp in var
00207 
00208     virtual void myExponents(std::vector<long>& v, ConstRawPtr rawpp) const = 0;  ///< get exponents, SHOULD BE vector<ZZ> ????
00209     virtual void myComputeDivMask(DivMask& dm, const DivMaskRule& DivMaskImpl, ConstRawPtr rawpp) const = 0; ///< computes the DivMask for pp according to DivMaskImpl
00210     virtual void myOutputSelf(std::ostream& out) const = 0;                    ///< print value of PPMonoid
00211 //???    virtual void myOutputSelf(OpenMathOutput& OMOut) const = 0;       ///< print OpenMath value of PPMonoid
00212     virtual void myOutput(std::ostream& out, ConstRawPtr rawpp) const;            ///< NOT PURE!!
00213     virtual void myOutput(OpenMathOutput& OMOut, ConstRawPtr rawpp) const;///< NOT PURE!!
00214 
00215   protected: // data member (common to all PPOrdering implementations)
00216     const PPOrdering myOrd;
00217   };
00218 
00219   const std::vector<PPMonoidElem>& indets(const PPMonoid& PPM);      ///< std::vector whose n-th entry is n-th indet as PPMonoidElem
00220   std::vector<symbol> symbols(const PPMonoid& PPM);                  ///< std::vector of the symbols in PPM
00221 
00222   std::size_t StdDeg(ConstRefPPMonoidElem pp);                       ///< standard degree of pp
00223   degree wdeg(ConstRefPPMonoidElem pp);                              ///< degree according to grading
00224   int CmpWDeg(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);   ///< <0 =0 >0 according as wdeg(t1) < = > wdeg(t2)
00225   long log(ConstRefPPMonoidElem pp, std::size_t var);                ///< degree in indet of index var
00226   ZZ ZZLog(ConstRefPPMonoidElem pp, std::size_t var);                ///< degree in indet of index var
00227   void exponents(std::vector<long>& v, ConstRefPPMonoidElem pp);     ///< SHOULD BE vector<ZZ> ????
00228   void swap(RefPPMonoidElem pp1, RefPPMonoidElem pp2);               ///< swap(t1, t2);
00229 
00230   // comparisons
00231   bool IsOne(ConstRefPPMonoidElem pp);
00232   bool IsIndet(std::size_t& index, ConstRefPPMonoidElem pp);
00233   bool IsIndetPower(std::size_t& index, ZZ& exp, ConstRefPPMonoidElem pp);
00234   int cmp(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);         ///< <0, =0, >0 as pp1 < = > pp2
00235   bool operator==(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1 == pp2;
00236   bool operator!=(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1 != pp2;
00237   bool operator<(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);  ///< pp1 < pp2;
00238   bool operator<=(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1 <= pp2;
00239   bool operator>(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);  ///< pp1 > pp2;
00240   bool operator>=(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1 => pp2;
00241 
00242   std::ostream& operator<<(std::ostream& out, const PPMonoid& PPM);
00243   std::ostream& operator<<(std::ostream& out, ConstRefPPMonoidElem pp);
00244   OpenMathOutput& operator<<(OpenMathOutput& OMOut, ConstRefPPMonoidElem t);
00245 
00246 
00247   // arithmetic
00248   PPMonoidElem operator*(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1*pp2;
00249   PPMonoidElem operator/(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2); ///< pp1/pp2;
00250   PPMonoidElem colon(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);     ///< pp1:pp2
00251   PPMonoidElem gcd(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);       ///< gcd(pp1, pp2)
00252   PPMonoidElem lcm(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);       ///< lcm(pp1, pp2)
00253   PPMonoidElem power(ConstRefPPMonoidElem pp, long exp);                      ///< pp^exp
00254   PPMonoidElem power(ConstRefPPMonoidElem pp, const ZZ& EXP);                 ///< pp^EXP
00255   bool IsCoprime(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);         ///< is gcd(pp1, pp2)=1?
00256   bool IsDivisible(ConstRefPPMonoidElem pp1, ConstRefPPMonoidElem pp2);       ///< is pp1 divisible by pp2?
00257 
00258   void AssignOne(RefPPMonoidElem dest);
00259   RefPPMonoidElem operator*=(RefPPMonoidElem dest, ConstRefPPMonoidElem t);
00260   RefPPMonoidElem operator/=(RefPPMonoidElem dest, ConstRefPPMonoidElem t);
00261 
00262   ConstRefPPMonoidElem indet(const PPMonoid& M, std::size_t var);
00263   PPMonoidElem IndetPower(const PPMonoid& M, std::size_t var, long exp);
00264 
00265   PPMonoid NewPPMonoid(const std::vector<symbol>& IndetNames, const PPOrdering& ord);
00266 
00267 
00268   //---------------------------------------------------------------------------
00269   // INLINE FUNCTIONS
00270 
00271   inline bool PPMonoidElemConstRawPtr::operator==(const PPMonoidElemConstRawPtr& pp) const
00272   {
00273     return myPtr == pp.myPtr;
00274   }
00275 
00276 
00277   inline bool PPMonoidElemConstRawPtr::operator!=(const PPMonoidElemConstRawPtr& pp) const
00278   {
00279     return !operator==(pp); // weird syntax
00280   }
00281 
00282 
00283 
00284   //---------------------------------------------------------------------------
00285   // inline functions on PPMonoids -- the order of appearance might be important!
00286 
00287 
00288   inline bool operator!=(const PPMonoid& M1, const PPMonoid& M2)
00289   {
00290     return !(M1 == M2);
00291   }
00292 
00293 
00294   //----------------------------------------------------------------------
00295 
00296 
00297   inline ConstRefPPMonoidElem one(const PPMonoid& PPM)
00298   {
00299     return PPM->myOne();
00300   }
00301 
00302 
00303   inline const PPOrdering& PPMonoidBase::myOrdering() const
00304   {
00305     return myOrd;
00306   }
00307 
00308 
00309   inline std::size_t NumIndets(const PPMonoid& M)
00310   {
00311     return M->myNumIndets();
00312   }
00313 
00314 
00315   inline const PPOrdering& ordering(const PPMonoid& M)
00316   {
00317     return M->myOrdering();
00318   }
00319 
00320 
00321   inline std::size_t GradingDim(const PPMonoid& M)
00322   {
00323     return GradingDim(ordering(M));
00324   }
00325 
00326 
00327   inline const std::vector<PPMonoidElem>& indets(const PPMonoid& PPM)
00328   {
00329     return PPM->myIndets();
00330   }
00331 
00332 
00333   inline ConstRefPPMonoidElem::ConstRefPPMonoidElem(const PPMonoid& PPM, PPMonoidElemConstRawPtr rawpp):
00334       myPPM(PPM), myPPPtr(const_cast<void*>(rawpp.myRawPtr()))
00335   {}
00336 
00337 
00338   inline RefPPMonoidElem::RefPPMonoidElem(const PPMonoid& PPM, PPMonoidElemRawPtr rawpp):
00339       ConstRefPPMonoidElem(PPM, rawpp)
00340   {}
00341 
00342 
00343   inline const PPMonoid& owner(const ConstRefPPMonoidElem& rawpp)
00344   {
00345     return rawpp.myPPM;
00346   }
00347 
00348 
00349   inline PPMonoidElemRawPtr raw(RefPPMonoidElem& rawpp)
00350   {
00351     return rawpp.myPPPtr;
00352   }
00353 
00354 
00355   inline PPMonoidElemConstRawPtr raw(const ConstRefPPMonoidElem& rawpp)
00356   {
00357     return rawpp.myPPPtr;
00358   }
00359 
00360 
00361   inline PPMonoidBase::PPMonoidBase(const PPOrdering& ord):
00362     IntrusiveReferenceCount(),
00363     myOrd(ord)
00364   {}
00365 
00366 
00367 } // end of namespace CoCoA
00368 
00369 
00370 
00371 // RCS header/log in the next few lines
00372 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/PPMonoid.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00373 // $Log: PPMonoid.H,v $
00374 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00375 // Imported files
00376 //
00377 // Revision 1.14  2007/03/08 18:42:06  cocoa
00378 // Cleaned up whitespace.
00379 //
00380 // Revision 1.13  2007/03/08 17:43:11  cocoa
00381 // Swapped order of args to the NewPPMonoid pseudo ctors.
00382 //
00383 // Revision 1.12  2007/01/11 14:06:15  cocoa
00384 // -- added prefix "raw" to RawPtr arguments names
00385 //
00386 // Revision 1.11  2006/12/06 17:32:24  cocoa
00387 // -- removed #include "config.H"
00388 //
00389 // Revision 1.10  2006/11/24 17:26:22  cocoa
00390 // -- reorganized includes of header files
00391 // -- doxygen style comments
00392 //
00393 // Revision 1.9  2006/11/23 17:35:48  cocoa
00394 // -- changed: PPMonoid is now a class (instead of typedef)
00395 //
00396 // Revision 1.8  2006/11/22 14:53:46  cocoa
00397 // -- changed: PPMonoid defined as class (instead of typedef)
00398 //
00399 // Revision 1.7  2006/11/03 15:37:47  cocoa
00400 // -- cleaned up code after testing on usage of SmartPtrIRC
00401 //
00402 // Revision 1.6  2006/11/03 14:01:46  cocoa
00403 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
00404 //    uses SmartPtrIRC
00405 //
00406 // Revision 1.5  2006/11/02 13:25:44  cocoa
00407 // Simplification of header files: the OpenMath classes have been renamed.
00408 // Many minor consequential changes.
00409 //
00410 // Revision 1.4  2006/10/06 14:04:15  cocoa
00411 // Corrected position of #ifndef in header files.
00412 // Separated CoCoA_ASSERT into assert.H from config.H;
00413 // many minor consequential changes (have to #include assert.H).
00414 // A little tidying of #include directives (esp. in Max's code).
00415 //
00416 // Revision 1.3  2006/10/06 10:08:58  cocoa
00417 // Corrected a comment.
00418 //
00419 // Revision 1.2  2006/08/07 21:23:25  cocoa
00420 // Removed almost all publicly visible references to SmallExponent_t;
00421 // changed to long in all PPMonoid functions and SparsePolyRing functions.
00422 // DivMask remains to sorted out.
00423 //
00424 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00425 // Imported files
00426 //
00427 // Revision 1.11  2006/05/12 16:10:58  cocoa
00428 // Added OpenMathFwd.H, and tidied OpenMath.H.
00429 // Many consequential but trivial changes.
00430 //
00431 // Revision 1.10  2006/04/21 14:59:22  cocoa
00432 // Changed return type of indet(PPM, i) to ConstRefPPMonoidElem
00433 // instead of PPMonoidElem (which made a copy).
00434 //
00435 // Revision 1.9  2006/03/27 12:21:26  cocoa
00436 // Minor silly changes to reduce number of complaints from some compiler or other.
00437 //
00438 // Revision 1.8  2006/03/15 18:09:31  cocoa
00439 // Changed names of member functions which print out their object
00440 // into myOutputSelf -- hope this will appease the Intel C++ compiler.
00441 //
00442 // Revision 1.7  2006/03/12 21:28:34  cocoa
00443 // Major check in after many changes
00444 //
00445 // Revision 1.6  2006/03/07 10:08:48  cocoa
00446 // -- fixed: PPMonoidElem(const ConstRefPPMonoidElem& copy);  [added const]
00447 //
00448 // Revision 1.5  2006/02/20 22:41:20  cocoa
00449 // All forms of the log function for power products now return SmallExponent_t
00450 // (instead of int).  exponents now resizes the vector rather than requiring
00451 // the user to pass in the correct size.
00452 //
00453 // Revision 1.4  2006/02/01 16:56:13  cocoa
00454 // Added some missing assignment operators for (Ref)PPMonoidElems.
00455 //
00456 // Revision 1.3  2006/01/17 10:23:08  cocoa
00457 // Updated DivMask; many consequential changes.
00458 // A few other minor fixes.
00459 //
00460 // Revision 1.2  2005/11/17 15:43:04  cocoa
00461 // -- added ctor PPMonoidElem(ConstRefPPMonoidElem& copy);
00462 //
00463 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00464 // Imported files
00465 //
00466 // Revision 1.7  2005/08/08 16:36:33  cocoa
00467 // Just checking in before going on holiday.
00468 // Don't really recall what changes have been made.
00469 // Added IsIndet function for RingElem, PPMonoidElem,
00470 // and a member function of OrdvArith.
00471 // Improved the way failed assertions are handled.
00472 //
00473 // Revision 1.6  2005/07/19 15:30:20  cocoa
00474 // A first attempt at iterators over sparse polynomials.
00475 // Main additions are to SparsePolyRing, DistrMPoly*.
00476 // Some consequential changes to PPMonoid*.
00477 //
00478 // Revision 1.5  2005/07/08 15:09:29  cocoa
00479 // Added new symbol class (to represent names of indets).
00480 // Integrated the new class into concrete polynomial rings
00481 // and PPMonoid -- many consequential changes.
00482 // Change ctors for the "inline" sparse poly rings: they no
00483 // longer expect a PPMonoid, but build their own instead
00484 // (has to be a PPMonoidOv).
00485 //
00486 // Revision 1.4  2005/07/01 16:08:16  cocoa
00487 // Friday check-in.  Major change to structure under PolyRing:
00488 // now SparsePolyRing and DUPolyRing are separated (in preparation
00489 // for implementing iterators).
00490 //
00491 // A number of other relatively minor changes had to be chased through
00492 // (e.g. IndetPower).
00493 //
00494 // Revision 1.3  2005/06/23 15:42:41  cocoa
00495 // Fixed typo in GNU fdl -- all doc/*.txt files affected.
00496 // Minor corrections to PPMonoid (discovered while writing doc).
00497 //
00498 // Revision 1.2  2005/06/22 14:47:56  cocoa
00499 // PPMonoids and PPMonoidElems updated to mirror the structure
00500 // used for rings and RingElems.  Many consequential changes.
00501 //
00502 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00503 // Imported files
00504 //
00505 // Revision 1.3  2005/04/29 15:42:02  cocoa
00506 // Improved documentation for GMPAllocator.
00507 // Added example program for GMPAllocator.
00508 // Added example program for simple ops on polynomials.
00509 // Added two new ctors for (principal) ideals (from long, and from ZZ).
00510 // Added (crude) printing for PPMonoids.
00511 // Updated library.H (#included GMPAllocator.H).
00512 //
00513 // Revision 1.2  2005/04/19 14:06:04  cocoa
00514 // Added GPL and GFDL licence stuff.
00515 //
00516 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00517 // Imported files
00518 //
00519 // Revision 1.14  2004/11/25 16:14:21  cocoa
00520 // (1) Fixed definition of specialization of std::swap template function
00521 //     so that it compiles with gcc 3.4.3
00522 // (2) Implemented monomial function for polynomial rings.
00523 // (3) Added one(PPM) and PPM->myOne() functions.
00524 //
00525 // Revision 1.13  2004/11/11 13:41:14  cocoa
00526 // -- moved CoCoA includes to the top
00527 //
00528 // Revision 1.12  2004/11/08 14:03:32  cocoa
00529 // -- small changes for doxygen support
00530 //
00531 // Revision 1.11  2004/11/02 14:56:33  cocoa
00532 // -- changed *Print* into *Output* (myPrint --> myOutput)
00533 // -- changed *Var* into *Indet* (myPrintVarName --> myOutputIndetName)
00534 // -- removed suffix "IgnoreDivMask"
00535 // -- added myComputeDivMask
00536 // -- improved storing of IndetNames
00537 // -- changed ExpvElem into SmallExponent_t
00538 //
00539 // Revision 1.10  2004/10/29 16:11:10  cocoa
00540 // -- new type   PPMonoidEvOv_entry;
00541 // -- function IsDivisible had wrong semantics --> swapped arguments everywhere
00542 //
00543 // Revision 1.9  2004/10/21 17:16:37  cocoa
00544 // Fairly major change: new OrdvArith namspace with various members,
00545 //   new global typedef  SmallExponent_t (defined in config.H).
00546 //
00547 // Revision 1.8  2004/06/30 16:46:06  cocoa
00548 // End of day check-in: mostly tidying up, and correcting some
00549 // overly lax access permissions.
00550 //
00551 // Revision 1.7  2004/06/29 17:10:22  cocoa
00552 // Partially tidied use of "protected" and "private" in various
00553 // base classes.  Checking in at the end of the day -- it works,
00554 // and I wouldn't want it to be lost next time point's disk
00555 // misbehaves.
00556 //
00557 // Revision 1.6  2004/05/27 16:14:02  cocoa
00558 // Minor revision for new coding conventions.
00559 //
00560 // Revision 1.5  2004/05/24 15:52:14  cocoa
00561 // Major update:
00562 //   new error mechanism
00563 //   many fixes
00564 //   RingHoms almost work now
00565 //   RingFloat much improved
00566 //
00567 // Revision 1.4  2004/03/20 17:46:10  cocoa
00568 // Check in prior to departure to RWCA
00569 //
00570 // Revision 1.3  2004/01/28 15:20:36  cocoa
00571 // Added CmpDeg function and myCmpDeg member function.
00572 // Aligned name of data member of PPMonoid with the convention used
00573 // for the data member of ring.
00574 //
00575 // Revision 1.2  2003/10/01 10:35:31  cocoa
00576 // - applied "my" coding convention to PPMonoid and PPOrdering
00577 //
00578 // Revision 1.1.1.1  2003/09/24 12:55:43  cocoa
00579 // Imported files
00580 //
00581 // Revision 1.22  2003/09/23 16:59:33  bigatti
00582 // - added PPMonoidDiv_entry* in RawPP
00583 //
00584 // Revision 1.21  2003/06/23 16:56:59  abbott
00585 // Minor cleaning prior to public release.
00586 //
00587 // Revision 1.20  2003/05/14 16:38:54  abbott
00588 // Changed name of assign1 to AssignOne.
00589 // Added new member functions PPMonoidBase::IsOne, IsOneIgnoreDivMask,
00590 // IsEqual, and IsEqualIgnoreDivMask (following the pattern of
00591 // IsDivisible).
00592 // Added PPMonoidBase::ZeroRefCount.
00593 // Added inline definitions of IsOne and IsEqual.
00594 //
00595 // Revision 1.19  2003/04/29 13:59:29  abbott
00596 // Uh oh.  Lots of changes.  Checking in prior to restructuring
00597 // to align with new PPOrdering code.
00598 //
00599 // Revision 1.18  2003/01/15 15:58:39  abbott
00600 // Checking in prior to major change.
00601 // Minor changes:
00602 //   coprime has become AreCoprime,
00603 //   divides has become IsDivisible,
00604 //   new member fn IsDivisibleIgnoreDivMask,
00605 //   signature of deg has changed (now produces values of type degree)
00606 //
00607 // Revision 1.17  2002/11/15 16:24:50  abbott
00608 // MAJOR CHANGE reflecting a new "philosophy".
00609 // The new philosophy is that PPMonoid::elems will be "slow and safe" since
00610 // they are now higly decoupled from the internal representation of
00611 // polynomials (which use "order vectors").
00612 // Eliminated HalfPP, alias and temp subclasses.
00613 // Every RawPP now contains its own "divisibility mask" because Anna needs
00614 // the DivMask check to be inline.
00615 //
00616 // Revision 1.16  2002/06/22 17:15:14  abbott
00617 // Numerous changes to accommodate the new idea of PPOrdering.
00618 //
00619 // Revision 1.15  2002/03/06 11:22:38  abbott
00620 // Added stubs for two new comparison functions (implemented via
00621 // member functions) to allow comparison between a RawPP and a
00622 // HalfPP, and between two HalfPPs.
00623 //
00624 // Revision 1.14  2002/02/08 12:07:22  abbott
00625 // MAJOR CHANGE: added two new proxy classes "alias" and "temp" (see PP.txt)
00626 // Numerous consequential changes.  Changed order of some declarations.
00627 //
00628 // Revision 1.13  2002/01/30 14:18:19  abbott
00629 // Replaced VarName function by PrintVarName; simplifies maintaining backward
00630 // compatibility with gcc 2.95, and may even be slightly easier to use.
00631 // Added owner(...) and raw(..) functions for PPMonoid::elem objects.
00632 //
00633 // Revision 1.12  2002/01/10 17:04:39  abbott
00634 // Revised names of two of the members of the RawPP union to
00635 // concord with their implementations.  The new names also
00636 // make more sense than the old ones.
00637 //
00638 // Revision 1.11  2002/01/09 14:32:40  abbott
00639 // Added/corrected HalfPP type and operations.
00640 //
00641 // Revision 1.10  2001/12/12 18:32:23  bigatti
00642 // - HalfMul and OtherHalfMul
00643 //
00644 // Revision 1.9  2001/12/07 18:17:46  abbott
00645 // Added field cpctexp in RawPP for PP_compact values.
00646 // The field needs a better name.
00647 //
00648 // Revision 1.8  2001/12/05 15:18:40  abbott
00649 // Act first, think later...  Fixed another copy of the name of struct PPMonoid_DenseUniq.
00650 //
00651 // Revision 1.7  2001/12/05 15:17:46  abbott
00652 // Corrected name of struct PPmonoid_DenseUniq_entry.
00653 //
00654 // Revision 1.6  2001/12/04 19:53:08  abbott
00655 // Names changed in accordance with new coding standards.
00656 // (public) Function NumVars is now a non-member (but calls a private member
00657 // function to allow inheritance to work as desired).
00658 //
00659 // Revision 1.5  2001/11/19 15:27:24  abbott
00660 // Added support for "compact_uniq" PP implementation:
00661 //   one forward declaration of a struct,
00662 //   a new field to the PPmonoid::raw_elem union.
00663 //
00664 // Revision 1.4  2001/11/16 18:40:00  bigatti
00665 // added: <iostream> and std::
00666 // for compatibility with gcc-3
00667 //
00668 // Revision 1.3  2001/11/05 18:13:29  abbott
00669 // Added homogeneous PP comparison functions: i.e. assuming two PPs have the
00670 // same (multi)degree it compares the PPs using the monoid's ordering.
00671 //
00672 // Anna also wanted an explicit homog_degrevlex; JAA hopes this function will
00673 // eventually disappear, though it may be needed for efficiency reasons.
00674 //
00675 // The names homog_cmp and homog_degrevlex are too cumbersome.
00676 //
00677 // Revision 1.2  2001/10/31 20:25:56  abbott
00678 // MAIN CHANGE:
00679 //   PPmonoid::raw_elem is now a union of the different types it can hold
00680 //   rather than a void*.  JAA is not sure if it is really cleaner to use
00681 //   a union than a void* (with casting), but the compiler gave enough
00682 //   problems to make the change worthwhile.  Furthermore, a union does
00683 //   give some extra checks/restrictions on what can be done to raw_elem.
00684 //   One significant difficulty was producing an l-value when using a
00685 //   (reinterpret) cast hidden inside a file static inline function.
00686 //   Also it is easier to debug with unions since the debugger will allow
00687 //   field selection in unions -- reinterpret_casts were a headache.
00688 //
00689 // The "copy constructor" for a PPmonoid::elem was altered to require a const
00690 // copy (previously the const was missing).
00691 //
00692 // Revision 1.1  2001/10/25 17:53:53  abbott
00693 // Initial revision
00694 //
00695 
00696 #endif

Generated on Wed May 23 13:45:23 2007 for CoCoALib by  doxygen 1.4.6