CoCoALib-0.9905 date: 23 May 2007


DistrMPolyInlFpPP.H

Go to the documentation of this file.
00001 #ifndef CoCoA_DistrMPolyInlFpPP_H
00002 #define CoCoA_DistrMPolyInlFpPP_H
00003 
00004 //   Copyright (c)  2005  Anna Bigatti
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 // Header file for the class DistrMPolyInlFpPP
00024 
00025 
00026 #include "CoCoA/assert.H"
00027 #include "CoCoA/SparsePolyRing.H"
00028 #include "CoCoA/OrdvArith.H"
00029 #include "CoCoA/PPMonoid.H"
00030 #include "CoCoA/MemPool.H"
00031 #include "CoCoA/SmallFpImpl.H"
00032 #include "CoCoA/SmallFpLogImpl.H"
00033 
00034 
00035 #include <cstddef>
00036 // using std::size_t;
00037 #include <iosfwd>
00038 // using std::ostream;
00039 #include <vector>
00040 // using std::vector;
00041 
00042 namespace CoCoA
00043 {
00044 
00045 /*-- class DistrMPolyInlFpPP --------------------------------------*/
00046 /**
00047   \brief Implementation of polynomials for RingDistrMPolyInlFpPP
00048 
00049   \include DistrMPolyInlFpPP.txt
00050   */
00051 /*-----------------------------------------------------------------*/
00052 
00053   class DistrMPolyInlFpPP
00054   {
00055   public:
00056     typedef SmallFpImpl InlineFpImpl;
00057     //typedef SmallFpLogImpl InlineFpImpl;
00058     typedef InlineFpImpl::value_t  InlineFpElem_t;
00059 
00060   private:
00061 
00062     //    class NewSummandPtr;
00063     friend class NewSummandPtr;
00064 
00065     struct summand
00066     {
00067     public:                    // These two lines are here
00068       static void useless() {} // just so gcc doesn't print annoying warnings.
00069     public:
00070       summand* myNext;
00071       InlineFpElem_t myCoeff;
00072       OrdvArith::OrdvElem myOrdv[1]; // ASSUMES the compiler will allocate this at the end,
00073                                      // so I can address elements with index greater than
00074                                      // 1 with impunity if I know the space exists.
00075     private:
00076       summand();                          // NEVER DEFINED
00077       ~summand();                         // NEVER DEFINED
00078       summand(const summand&);            // NEVER DEFINED
00079       summand& operator=(const summand&); // NEVER DEFINED
00080     };
00081     static void ourDeleteSummands(summand* ptr, MemPool& MemMgr);
00082 
00083     // This class should permit exception-clean implementations.
00084     class NewSummandPtr
00085     {
00086     public:
00087       explicit NewSummandPtr(const DistrMPolyInlFpPP& f): myPtr(0), myFp(f.myILCoeffImpl), /*myPPM(f.myPPM),*/ myOrdvArith(f.myOrdvArith.myRawPtr()), myMemMgr(f.mySummandMemory) { }
00088       ~NewSummandPtr() { if (myPtr != 0) DistrMPolyInlFpPP::ourDeleteSummands(myPtr, myMemMgr); }
00089       const summand* get() const { return myPtr; }
00090       summand* operator->() { return myPtr; }
00091       const summand* operator->() const { return myPtr; }
00092       summand* relinquish()  { CoCoA_ASSERT(myPtr != 0); summand* ans = myPtr; myPtr = 0; return ans; }
00093       friend inline summand* grab(NewSummandPtr& s) { CoCoA_ASSERT(!s.myFp.myIsZero(s.myPtr->myCoeff)); return s.relinquish(); }
00094       void myRenew() { CoCoA_ASSERT(myPtr == 0); alloc(); myAssignZero(); }
00095     private:
00096       summand* myPtr; //??? auto_ptr???
00097       const InlineFpImpl& myFp;
00098 //???      const PPMonoid myPPM;
00099       const OrdvArith::base* myOrdvArith;
00100       MemPool& myMemMgr;
00101       void alloc() { CoCoA_ASSERT(myPtr == 0); myPtr = static_cast<summand*>(myMemMgr.alloc()); }
00102       void myAssignZero() { myPtr->myNext = 0; myFp.myAssignZero(myPtr->myCoeff); myOrdvArith->myAssignZero(myPtr->myOrdv); };
00103 
00104     private:
00105       NewSummandPtr& operator=(const NewSummandPtr&);  // NEVER DEFINED
00106       NewSummandPtr(const NewSummandPtr&);             // NEVER DEFINED
00107     };
00108 
00109 
00110   private: // data members
00111     const InlineFpImpl& myILCoeffImpl;
00112     const ring myCoeffRingValue;
00113     const PPMonoid myPPMValue;
00114     OrdvArith::reference myOrdvArith;
00115     MemPool& mySummandMemory;
00116     summand** myEnd; // for the one-past-the-last iterator
00117     summand* mySummands;
00118 
00119   public:
00120     DistrMPolyInlFpPP(const InlineFpImpl&, const ring&, const PPMonoid&, const OrdvArith::reference&, MemPool&);
00121     DistrMPolyInlFpPP(const DistrMPolyInlFpPP& copy);
00122     ~DistrMPolyInlFpPP();
00123     DistrMPolyInlFpPP& operator=(const DistrMPolyInlFpPP& rhs);
00124     DistrMPolyInlFpPP& operator=(long rhs);
00125     DistrMPolyInlFpPP& operator=(const ZZ& rhs);
00126 
00127     friend bool IsCompatible(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00128     static std::size_t SummandSize(const ring&, const OrdvArith::reference& OA);
00129     static void ourSwap(DistrMPolyInlFpPP&, DistrMPolyInlFpPP&);
00130     summand* myCopySummand(const summand* original) const;
00131     const ring& myCoeffRing() const;
00132     const PPMonoid& myPPM() const;
00133     // functions depending solely on the structure
00134     void myAssignZero();
00135 
00136     bool myIsEqual(const summand* const lhs, const summand*const rhs) const;
00137     friend std::size_t NumTerms(const DistrMPolyInlFpPP& f);
00138     friend const InlineFpElem_t& LC(const DistrMPolyInlFpPP& f);
00139     friend ConstRefPPMonoidElem LPP(const DistrMPolyInlFpPP& f);
00140     friend int CmpLPP(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00141     friend void MoveLM(DistrMPolyInlFpPP& f, DistrMPolyInlFpPP& g);
00142     void myDeleteLM();
00143 //     friend std::size_t StdDeg(const DistrMPolyInlFpPP& f);
00144 //     friend void wdeg(degree& d, const DistrMPolyInlFpPP& f);
00145 //     friend int CmpWDeg(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00146 //     friend long log(const DistrMPolyInlFpPP& f, std::size_t IndetIndex);
00147     void myAddMul(const DistrMPolyInlFpPP& h, const DistrMPolyInlFpPP& g, bool SkipLMg);
00148     //    void WeylAddMul(const DistrMPolyInlFpPP& h, const DistrMPolyInlFpPP& g);
00149     void myReductionStep(const DistrMPolyInlFpPP& g);
00150     void myReductionStepGCD(const DistrMPolyInlFpPP& g, RefRingElem fscale);
00151     void myAddClear(DistrMPolyInlFpPP& g);
00152     void myAppendClear(DistrMPolyInlFpPP& g);
00153     friend void DivLM(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00154     void myMulByCoeff(InlineFpElem_t c);  ///< NO THROW GUARANTEE (???)
00155     void myDivByCoeff(InlineFpElem_t c);  ///< NO THROW GUARANTEE (???)
00156     void myMulByPP(PPMonoidElemConstRawPtr rawpp);  ///< EXCEPTION SAFE
00157     void myWeylMul(PPMonoidElemConstRawPtr rawpp);
00158     void myPushFront(const InlineFpElem_t c, const std::vector<long>& expv);
00159     void myPushBack(const InlineFpElem_t c, const std::vector<long>& expv);
00160     void myPushFront(summand* t);
00161     void myPushBack(summand* t);
00162     void myRemoveSummand(summand** prev_link);
00163     void myInsertSummand(summand* s, summand** prev_link);
00164     friend bool IsZeroAddLCs(DistrMPolyInlFpPP& f, DistrMPolyInlFpPP& g);
00165     void myNegate();
00166 
00167     friend void add(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00168     friend void sub(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00169     //    friend void mul(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00170     friend bool div(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00171     friend void gcd(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00172     friend void output(std::ostream& out, const DistrMPolyInlFpPP& f);
00173 //     friend bool IsPrintAtom(const DistrMPolyInlFpPP& f);
00174 //     friend void output(OpenMathOutput& OMOut, const DistrMPolyInlFpPP& f);
00175     friend bool IsZero(const DistrMPolyInlFpPP& f);
00176 //     friend bool IsOne(const DistrMPolyInlFpPP& f);
00177 //     friend bool IsMinusOne(const DistrMPolyInlFpPP& f);
00178 //     friend bool IsConstant(const DistrMPolyInlFpPP& f);
00179 //     friend bool IsIndet(std::size_t& index, const DistrMPolyInlFpPP& f);
00180     friend bool IsMonomial(const DistrMPolyInlFpPP& f);
00181     friend bool IsEqual(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00182     friend void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP&, std::size_t IndetIndex);
00183     friend void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& f, ConstRefPPMonoidElem x);
00184 
00185     friend void WeylMul(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00186     friend void WeylDiv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00187   private:
00188      void myAddMulSummand(const summand* s, const DistrMPolyInlFpPP& g, bool SkipLMg);
00189      void myWeylAddMulSummand(const summand* s, const DistrMPolyInlFpPP& g, bool SkipLMg);
00190 
00191   public:
00192     class iter: public SparsePolyIterBase
00193     {
00194     public:
00195       explicit iter(const DistrMPolyInlFpPP& f);
00196       iter(const DistrMPolyInlFpPP& f, const summand* TermPtr);
00197       // Default copy ctor and assignment are fine
00198       // Default dtor is fine.
00199       iter* myClone() const;
00200       bool IamEnded() const;
00201       void myForward();
00202       iter& operator++();
00203       iter operator++(int);
00204       ConstRefRingElem myCoeff() const;
00205       ConstRefPPMonoidElem myPP() const;
00206 //???      bool operator==(const iter& i2) const;
00207 //???      bool operator!=(const iter& i2) const;
00208     protected:
00209       const void* myPolyPtr() const;
00210       const void* myTermPtr() const;
00211     private: // data members
00212       const DistrMPolyInlFpPP& myPoly;
00213       const summand* mySummand;
00214     };
00215 
00216   };
00217 
00218 
00219   void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP&, std::size_t IndetIndex);
00220   void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& f, ConstRefPPMonoidElem x);
00221 
00222 
00223   // Friend functions - must also be declared outside the class (how very tedious).
00224   bool IsCompatible(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00225   std::size_t NumTerms(const DistrMPolyInlFpPP& f);
00226   const DistrMPolyInlFpPP::InlineFpElem_t& LC(const DistrMPolyInlFpPP& f);
00227   ConstRefPPMonoidElem LPP(const DistrMPolyInlFpPP& f);
00228   int CmpLPP(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00229   void MoveLM(DistrMPolyInlFpPP& f, DistrMPolyInlFpPP& g);
00230   long log(const DistrMPolyInlFpPP& f, std::size_t IndetIndex);
00231   void DivLM(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00232   bool IsZeroAddLCs(DistrMPolyInlFpPP& f, DistrMPolyInlFpPP& g);
00233   void add(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00234   void sub(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00235   bool div(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00236   //  void gcd(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00237   void output(std::ostream& out, const DistrMPolyInlFpPP& f);
00238   //  bool IsPrintAtom(const DistrMPolyInlFpPP& f);
00239   //  void output(OpenMathOutput& OMOut, const DistrMPolyInlFpPP& f);
00240   bool IsZero(const DistrMPolyInlFpPP& f);
00241   //  bool IsOne(const DistrMPolyInlFpPP& f);
00242   //  bool IsMinusOne(const DistrMPolyInlFpPP& f);
00243   //  bool IsConstant(const DistrMPolyInlFpPP& f);
00244   //  bool IsIndet(std::size_t& index, const DistrMPolyInlFpPP& f);
00245   bool IsEqual(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g);
00246   void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP&, std::size_t IndetIndex);
00247   void deriv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& f, ConstRefPPMonoidElem x);
00248 
00249   void WeylMul(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00250   void WeylDiv(DistrMPolyInlFpPP& lhs, const DistrMPolyInlFpPP& g, const DistrMPolyInlFpPP& h);
00251 
00252   //---------------------------------------------------------------------------
00253   // Inline functions.
00254 
00255   inline std::size_t DistrMPolyInlFpPP::SummandSize(const ring&, const OrdvArith::reference& OA)
00256   {
00257     return sizeof(summand) + sizeof(OrdvArith::OrdvElem)*(OrdvWords(OA)-1);
00258   }
00259 
00260 
00261   inline const ring& DistrMPolyInlFpPP::myCoeffRing() const
00262   {
00263     return myCoeffRingValue;
00264   }
00265 
00266 
00267   inline const PPMonoid& DistrMPolyInlFpPP::myPPM() const
00268   {
00269     return myPPMValue;
00270   }
00271 
00272 
00273   inline int CmpLPP(const DistrMPolyInlFpPP& f, const DistrMPolyInlFpPP& g)
00274   {
00275     CoCoA_ASSERT(!IsZero(f) && !IsZero(g));
00276     return f.myOrdvArith->myCmp(f.mySummands->myOrdv, g.mySummands->myOrdv);
00277   }
00278 
00279 
00280   inline DistrMPolyInlFpPP::iter::iter(const DistrMPolyInlFpPP& f):
00281       myPoly(f),
00282       mySummand(f.mySummands)
00283   {}
00284 
00285 
00286   inline DistrMPolyInlFpPP::iter::iter(const DistrMPolyInlFpPP& f, const summand* TermPtr):
00287       myPoly(f),
00288       mySummand(TermPtr) // TermPtr *MUST* point to a term in f, or be NULL.
00289   {}
00290 
00291 
00292   inline DistrMPolyInlFpPP::iter* DistrMPolyInlFpPP::iter::myClone() const
00293   {
00294     return new iter(*this);
00295   }
00296 
00297 
00298   inline bool DistrMPolyInlFpPP::iter::IamEnded() const
00299   {
00300     return mySummand == 0;
00301   }
00302 
00303   inline bool IsEnded(const DistrMPolyInlFpPP::iter& i)
00304   {
00305     return i.IamEnded();
00306   }
00307 
00308 
00309   inline void DistrMPolyInlFpPP::iter::myForward()
00310   {
00311     CoCoA_ASSERT(!IamEnded());
00312     mySummand = mySummand->myNext;
00313   }
00314 
00315   inline DistrMPolyInlFpPP::iter& DistrMPolyInlFpPP::iter::operator++()
00316   {
00317     if (IamEnded()) CoCoA_ERROR(ERR::PolyIterEnded, "DistrMPolyInlFpPP::iter::op++");
00318     myForward(); //???mySummand = mySummand->myNext;
00319     return *this;
00320   }
00321 
00322 
00323   inline DistrMPolyInlFpPP::iter DistrMPolyInlFpPP::iter::operator++(int)
00324   {
00325     if (IamEnded()) CoCoA_ERROR(ERR::PolyIterEnded, "DistrMPolyInlFpPP::iter::op++");
00326     iter ans(*this);
00327     myForward(); //???mySummand = mySummand->myNext;
00328     return ans;
00329   }
00330 
00331 
00332   inline ConstRefRingElem DistrMPolyInlFpPP::iter::myCoeff() const
00333   {
00334     CoCoA_ASSERT(!IamEnded());
00335     return ConstRefRingElem(myPoly.myCoeffRing(), RingElemConstRawPtr(&(mySummand->myCoeff)));
00336   }
00337 
00338   inline ConstRefRingElem coeff(const DistrMPolyInlFpPP::iter& i)
00339   {
00340     if (IsEnded(i)) CoCoA_ERROR(ERR::PolyIterEnded, "coeff(PolyIter)");
00341     return i.myCoeff();
00342   }
00343 
00344 
00345   inline ConstRefPPMonoidElem DistrMPolyInlFpPP::iter::myPP() const
00346   {
00347     CoCoA_ASSERT(!IamEnded());
00348     return ConstRefPPMonoidElem(myPoly.myPPM(), PPMonoidElemConstRawPtr(mySummand->myOrdv));
00349   }
00350 
00351   inline ConstRefPPMonoidElem PP(const DistrMPolyInlFpPP::iter& i)
00352   {
00353     if (IsEnded(i)) CoCoA_ERROR(ERR::PolyIterEnded, "PP(PolyIter)");
00354     return i.myPP();
00355   }
00356 
00357 
00358 //   inline bool DistrMPolyInlFpPP::iter::operator==(const iter& i2) const
00359 //   {
00360 //     if (&myPoly != &(i2.myPoly)) CoCoA_ERROR(ERR::MixedPolyIters, "PolyIter == PolyIter");
00361 //     return mySummand == i2.mySummand;
00362 //   }
00363 
00364 //   inline bool DistrMPolyInlFpPP::iter::operator!=(const iter& i2) const
00365 //   {
00366 //     if (&myPoly != &(i2.myPoly)) CoCoA_ERROR(ERR::MixedPolyIters, "PolyIter != PolyIter");
00367 //     return mySummand != i2.mySummand;
00368 //   }
00369 
00370 
00371   inline const void* DistrMPolyInlFpPP::iter::myPolyPtr() const
00372   {
00373     return &myPoly;
00374   }
00375 
00376 
00377   inline const void* DistrMPolyInlFpPP::iter::myTermPtr() const
00378   {
00379     return mySummand;
00380   }
00381 
00382 
00383 //   //------------------------------------------------------------
00384 //   // InlineFpImpl inline functions
00385 //   //------------------------------------------------------------
00386 
00387 //   inline void InlineFpImpl::myAssign(InlineFpElem_t& lhs, const InlineFpElem_t rhs) const
00388 //   {
00389 //     lhs = rhs;
00390 //   }
00391 
00392 //   inline void InlineFpImpl::myAssign(InlineFpElem_t& lhs, long rhs) const
00393 //   {
00394 //     if (rhs>0) lhs = rhs%myModulus;
00395 //     else
00396 //     {
00397 //       lhs = myModulus-(-rhs)%myModulus;
00398 //       if (lhs==myModulus) lhs=0;
00399 //     }
00400 //   }
00401 
00402 //   inline void InlineFpImpl::myAssign(InlineFpElem_t& lhs, const mpz_t rhs) const
00403 //   {
00404 //     lhs = mpz_fdiv_ui(rhs, myModulus);
00405 //   }
00406 
00407 //   inline void InlineFpImpl::myNegate(InlineFpElem_t& lhs, const InlineFpElem_t rhs) const
00408 //   {
00409 //     CoCoA_ASSERT(lhs==lhs%myModulus);
00410 //     lhs = myModulus-rhs;
00411 //   }
00412 
00413 //   inline void InlineFpImpl::myAdd(InlineFpElem_t& lhs, const InlineFpElem_t x, const InlineFpElem_t y) const
00414 //   {
00415 //     CoCoA_ASSERT(x==x%myModulus);   CoCoA_ASSERT(y==y%myModulus);
00416 //     lhs = x+y;
00417 //     if (lhs>=myModulus) lhs-=myModulus;
00418 //   }
00419 
00420 //   inline void InlineFpImpl::mySub(InlineFpElem_t& lhs, const InlineFpElem_t x, const InlineFpElem_t y) const
00421 //   {
00422 //     CoCoA_ASSERT(x==x%myModulus);   CoCoA_ASSERT(y==y%myModulus);
00423 //     lhs = x-y;
00424 //     if (lhs<0) lhs+=myModulus;
00425 //   }
00426 
00427 //   inline void InlineFpImpl::myMul(InlineFpElem_t& lhs, const InlineFpElem_t x, const InlineFpElem_t y) const
00428 //   {
00429 //     CoCoA_ASSERT(x==x%myModulus);   CoCoA_ASSERT(y==y%myModulus);
00430 //     lhs = x*y;
00431 //     if (lhs>=myModulus) lhs = lhs%myModulus;
00432 //   }
00433 
00434 //   inline bool InlineFpImpl::myIsDivisible(InlineFpElem_t& lhs, const InlineFpElem_t x, const InlineFpElem_t y) const
00435 //   {
00436 //     if (myIsZero(y)) return false;
00437 //     myDiv(lhs, x, y);
00438 //     return true;
00439 //   }
00440 
00441 //   inline void InlineFpImpl::myOutput(std::ostream& out, const InlineFpElem_t x) const
00442 //   {
00443 //     out << x;
00444 //   }
00445 
00446 //   inline bool InlineFpImpl::myIsPrintAtom(const InlineFpElem_t x) const
00447 //   {
00448 //     return true;
00449 //   }
00450 
00451 //   inline bool InlineFpImpl::myIsPrintedWithMinus(const InlineFpElem_t x) const
00452 //   {
00453 //     return false;
00454 //   }
00455 
00456 //   inline bool InlineFpImpl::myIsZero(const InlineFpElem_t x) const
00457 //   {
00458 //     return x == 0;
00459 //   }
00460 
00461 //   inline bool InlineFpImpl::myIsOne(const InlineFpElem_t x) const
00462 //   {
00463 //     return x == 1;
00464 //   }
00465 
00466 //   inline bool InlineFpImpl::myIsMinusOne(const InlineFpElem_t x) const
00467 //   {
00468 //     return x == myModulus-1;
00469 //   }
00470 
00471 //   inline bool InlineFpImpl::myIsZeroAddMul(InlineFpElem_t& lhs, const InlineFpElem_t y, const InlineFpElem_t z) const
00472 //   {
00473 //     lhs = (lhs+(y*z))%myModulus;
00474 //     return lhs==0;
00475 //   }
00476 
00477 
00478 //   inline bool InlineFpImpl::myIsEqual(const InlineFpElem_t x, const InlineFpElem_t y) const
00479 //   {
00480 //     return x==y;
00481 //   }
00482 
00483 
00484 //   inline bool InlineFpImpl::operator==(const InlineFpImpl& R) const
00485 //   {
00486 //     return myModulus == R.myModulus;
00487 //   }
00488 
00489   inline void swap(DistrMPolyInlFpPP& f, DistrMPolyInlFpPP& g)
00490   {
00491     DistrMPolyInlFpPP::ourSwap(f, g);
00492   }
00493 
00494 
00495 } // end of namespace CoCoA
00496 
00497 
00498 
00499 // RCS header/log in the next few lines
00500 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/DistrMPolyInlFpPP.H,v 1.2 2007/03/12 16:00:29 bigatti Exp $
00501 // $Log: DistrMPolyInlFpPP.H,v $
00502 // Revision 1.2  2007/03/12 16:00:29  bigatti
00503 // -- moved myLog(F, index) into unique implementation in SparsePolyRing
00504 //
00505 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00506 // Imported files
00507 //
00508 // Revision 1.18  2007/03/08 18:42:06  cocoa
00509 // Cleaned up whitespace.
00510 //
00511 // Revision 1.17  2007/03/07 13:42:46  bigatti
00512 // -- removed useless argument and other minor changes
00513 //
00514 // Revision 1.16  2007/01/11 14:04:18  cocoa
00515 // -- added prefix "raw" to RawPtr arguments names
00516 //
00517 // Revision 1.15  2006/12/06 17:09:37  cocoa
00518 // -- removed #include "config.H"
00519 //
00520 // Revision 1.14  2006/11/24 17:16:29  cocoa
00521 // -- reorganized includes of header files
00522 //
00523 // Revision 1.13  2006/11/23 18:01:53  cocoa
00524 // -- moved printing functions in unified implementation in SparsePolyRing
00525 // -- simplified "output(f)" for debugging only
00526 //
00527 // Revision 1.12  2006/11/21 18:09:24  cocoa
00528 // -- added myIsMonomial
00529 // -- implemented myIsOne, myIsMinusOne, myIsConstant, myIsIndet in SparsePolyRing
00530 // -- removed the 4 functions from DistrMPoly(..) and RingDistrMPoly(..)
00531 // -- changed all names of RawPtr arguments into "raw(..)"
00532 //
00533 // Revision 1.11  2006/11/03 14:01:46  cocoa
00534 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
00535 //    uses SmartPtrIRC
00536 //
00537 // Revision 1.10  2006/11/02 13:25:44  cocoa
00538 // Simplification of header files: the OpenMath classes have been renamed.
00539 // Many minor consequential changes.
00540 //
00541 // Revision 1.9  2006/10/16 23:19:00  cocoa
00542 // Corrected use of std::swap and various special swap functions.
00543 // Improved myApply memfn for homs of RingDistrMPolyInlPP.
00544 //
00545 // Revision 1.8  2006/10/09 21:48:51  cocoa
00546 // Commented out "pointless" template specialization of std::swap.
00547 // Added overloading swap functions in CoCoA namespace.
00548 //
00549 // Revision 1.7  2006/10/06 14:04:16  cocoa
00550 // Corrected position of #ifndef in header files.
00551 // Separated CoCoA_ASSERT into assert.H from config.H;
00552 // many minor consequential changes (have to #include assert.H).
00553 // A little tidying of #include directives (esp. in Max's code).
00554 //
00555 // Revision 1.6  2006/10/06 10:00:18  cocoa
00556 // Added independent declarations of functions declared as friends -- permits
00557 // compilation with gcc-4.1 series.  Changes some friends into static member
00558 // functions.
00559 //
00560 // Revision 1.5  2006/08/07 21:23:25  cocoa
00561 // Removed almost all publicly visible references to SmallExponent_t;
00562 // changed to long in all PPMonoid functions and SparsePolyRing functions.
00563 // DivMask remains to sorted out.
00564 //
00565 // Revision 1.4  2006/07/20 17:06:08  cocoa
00566 // -- moved myStdDeg into SparsePolyRing
00567 //
00568 // Revision 1.3  2006/06/22 14:07:18  cocoa
00569 // Minor cleaning and elimination of useless #includes.
00570 //
00571 // Revision 1.2  2006/06/08 16:45:28  cocoa
00572 // -- RingDistrMPoly*.H  have been "moved" into RingDistrMPoly*.C
00573 // -- some coding conventions fixed in DistrMPoly*
00574 // -- functions wdeg and CmpWDeg have a common implementation in SparsePolyRing
00575 //
00576 // Revision 1.1.1.1  2006/05/30 11:39:36  cocoa
00577 // Imported files
00578 //
00579 // Revision 1.8  2006/05/12 16:10:59  cocoa
00580 // Added OpenMathFwd.H, and tidied OpenMath.H.
00581 // Many consequential but trivial changes.
00582 //
00583 // Revision 1.7  2006/04/26 16:44:53  cocoa
00584 // -- myMul has now a single implementation in SparsePolyRing
00585 // -- myMul and mul in RingDistrMPoly* and DistrMPoly* have been disabled
00586 //
00587 // Revision 1.6  2006/03/30 16:59:27  cocoa
00588 // -- changed misleading name: InlineCoeffRing --> InlineCoeffImpl
00589 // -- new: implementation for homomorphisms
00590 // -- rearrangement of code to mimic RingDistrMPolyInlPP
00591 //
00592 // Revision 1.5  2006/03/20 17:27:42  cocoa
00593 // -- changed in DistrMPolyInlFpPP: myMul, myDiv --> myMulByCoeff, myMulByPP, myDivByCoeff
00594 //
00595 // Revision 1.4  2006/03/12 21:28:34  cocoa
00596 // Major check in after many changes
00597 //
00598 // Revision 1.3  2006/03/07 10:06:12  cocoa
00599 // -- fixed: PPMonoidElem LPP(f) now returns ConstRefPPMonoidElem
00600 //
00601 // Revision 1.2  2006/02/13 13:17:40  cocoa
00602 // -- fixed: "const PPMonoidElem&" --> "ConstRefPPMonoidElem"
00603 //
00604 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00605 // Imported files
00606 //
00607 // Revision 1.7  2005/09/22 18:04:17  cocoa
00608 // It compiles; the tests run OK.  The examples compile.
00609 // No documentation -- the mindless eurocrats have rendered
00610 // me mindless too.
00611 //
00612 // Revision 1.6  2005/08/08 16:36:33  cocoa
00613 // Just checking in before going on holiday.
00614 // Don't really recall what changes have been made.
00615 // Added IsIndet function for RingElem, PPMonoidElem,
00616 // and a member function of OrdvArith.
00617 // Improved the way failed assertions are handled.
00618 //
00619 // Revision 1.5  2005/07/19 15:30:20  cocoa
00620 // A first attempt at iterators over sparse polynomials.
00621 // Main additions are to SparsePolyRing, DistrMPoly*.
00622 // Some consequential changes to PPMonoid*.
00623 //
00624 // Revision 1.4  2005/07/15 16:34:33  cocoa
00625 // Added iterators for sparse polynomials.
00626 // The code compiles (and the old tests still run).
00627 // It'd Friday evening -- I'm going home before
00628 // getting any ideas about making the iterator code run.
00629 //
00630 // Revision 1.3  2005/07/01 16:08:16  cocoa
00631 // Friday check-in.  Major change to structure under PolyRing:
00632 // now SparsePolyRing and DUPolyRing are separated (in preparation
00633 // for implementing iterators).
00634 //
00635 // A number of other relatively minor changes had to be chased through
00636 // (e.g. IndetPower).
00637 //
00638 // Revision 1.2  2005/06/22 14:47:56  cocoa
00639 // PPMonoids and PPMonoidElems updated to mirror the structure
00640 // used for rings and RingElems.  Many consequential changes.
00641 //
00642 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00643 // Imported files
00644 //
00645 // Revision 1.3  2005/04/19 14:06:04  cocoa
00646 // Added GPL and GFDL licence stuff.
00647 //
00648 // Revision 1.2  2005/02/11 14:15:20  cocoa
00649 // New style ring elements and references to ring elements;
00650 // I hope I have finally got it right!
00651 //
00652 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00653 // Imported files
00654 //
00655 // Revision 1.9  2004/11/25 16:14:21  cocoa
00656 // (1) Fixed definition of specialization of std::swap template function
00657 //     so that it compiles with gcc 3.4.3
00658 // (2) Implemented monomial function for polynomial rings.
00659 // (3) Added one(PPM) and PPM->myOne() functions.
00660 //
00661 // Revision 1.8  2004/11/11 13:11:09  cocoa
00662 // -- minor changes for doxygen
00663 //
00664 // Revision 1.7  2004/11/02 15:17:26  cocoa
00665 // -- minor changes for doxygen
00666 //
00667 // Revision 1.6  2004/10/29 15:26:18  cocoa
00668 // -- code fixed for compatibility with OrdvArith
00669 //
00670 // Revision 1.4  2004/07/20 15:37:08  cocoa
00671 // Minor fix for some errors which slipped through the net...
00672 //
00673 // Revision 1.3  2004/07/20 09:20:47  cocoa
00674 // -- myILineCoeffRing is now a reference!
00675 //
00676 // Revision 1.2  2004/07/16 10:11:34  cocoa
00677 // -- now using the new class SmallFpImpl (or SmallFpLogImpl)
00678 // -- updated with "my" coding convenctions
00679 // -- NYI: LC and LCRaw
00680 //
00681 // Revision 1.1  2004/06/25 16:03:58  cocoa
00682 // -- first import
00683 //
00684 
00685 #endif

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