1 #ifndef CoCoA_SparsePolyRing_H
2 #define CoCoA_SparsePolyRing_H
3 
4 //   Copyright (c)  2005-2007,2009,2012  John Abbott
5 
6 //   This file is part of the source of CoCoALib, the CoCoA Library.
7 
8 //   CoCoALib is free software: you can redistribute it and/or modify
9 //   it under the terms of the GNU General Public License as published by
10 //   the Free Software Foundation, either version 3 of the License, or
11 //   (at your option) any later version.
12 
13 //   CoCoALib is distributed in the hope that it will be useful,
14 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 //   GNU General Public License for more details.
17 
18 //   You should have received a copy of the GNU General Public License
19 //   along with CoCoALib.  If not, see <http://www.gnu.org/licenses/>.
20 
21 
22 // Header file for the abstract class SparsePolyRingBase etc.
23 
24 #include "CoCoA/PPMonoid.H"
25 #include "CoCoA/PolyRing.H"
26 #include "CoCoA/RingHom.H"
27 #include "CoCoA/error.H"
28 #include "CoCoA/ideal.H"
29 #include "CoCoA/FGModule.H"
30 //#include "CoCoA/MatrixForOrdering.H"
31 //#include "CoCoA/TmpUniversalInvolutiveBasisContainer.H"
32 
33 #include <iosfwd>
34 // using std::ostream;
35 #include <map>
36 #include <memory>
37 // using std::auto_ptr;
38 #include <vector>
39 // using std::vector;
40 
41 namespace CoCoA
42 {
43 
44   class CpuTimeLimit;   // fwd decl -- defined in CpuTimeLimit.H
45   class symbol;         // fwd decl -- defined in symbol.H
46   class matrix;         // fwd decl -- defined in matrix.H
47   class SparsePolyIter; // fwd decl -- defined in SparsePolyIter.H
48 
49   namespace Involutive
50   {
51     class UniversalInvolutiveBasisContainer; // fwd decl -- defined in TmpUniversalInvolutiveBasisContainer.H
52   }
53 
54 
55   class SparsePolyRingBase;
56 
57   class SparsePolyRing: public PolyRing
58   {
59   public:
60     SparsePolyRing(const ring& R);
61     explicit SparsePolyRing(const SparsePolyRingBase* RingPtr);
62     // Default copy ctor & assignment work fine.
63     // Default dtor works fine.
64   public:
65     const SparsePolyRingBase* operator->() const; ///< allow member fns to be called
66   };
67 
68 
69   class SparsePolyRingBase: public PolyRingBase
70   {
71   public:
72     ///@name Member functions every concrete SparsePolyRing implementation must have in addition to those of PolyRingBase.
73     //@{
74     virtual const PPMonoid& myPPM() const = 0;
myGradingDim()75     virtual long myGradingDim() const { return GradingDim(myPPM()); }
IamStdGraded()76     virtual bool IamStdGraded() const { return IsStdGraded(myPPM()); }
77 //    virtual void myWDeg(degree& d, ConstRawPtr rawf) const = 0;
78 //    virtual int myCmpWDeg(ConstRawPtr rawf, ConstRawPtr rawg) const = 0; //pure???
79     virtual ConstRefPPMonoidElem myLPP(ConstRawPtr rawf) const = 0;
80     virtual void myMulByPP(RawPtr rawf, PPMonoidElemConstRawPtr rawpp) const = 0;
81     virtual bool myIsHomog(ConstRawPtr rawf) const; ///< true iff f is homogeneous
82     virtual bool myIsHomogPartial(ConstRawPtr rawf, long n) const; ///< true iff f is homogeneous wrt the first n rows of weights (assumes 0 <= n <= GradingDim)
83     virtual void myHomog(RawPtr rawfHom, ConstRawPtr rawf, ConstRawPtr rawh) const;  ///< fHom = f homogenized with h (indet of wdeg 1, GrDim=1)
84     //@}
85 
86     ///@name   Functions for creating/building polynomials
87     //@{
88     virtual RingElem myMonomial(ConstRawPtr rawc, PPMonoidElemConstRawPtr rawpp) const = 0; // c is element of CoeffRing!!
89     virtual SparsePolyIter myBeginIter(ConstRawPtr rawf) const = 0;
90     virtual SparsePolyIter myEndIter(ConstRawPtr rawf) const = 0;
91     virtual void myPushFront(RawPtr rawf, ConstRawPtr rawc, const std::vector<long>& expv) const = 0; /// SHOULD BE vector<BigInt> ????
92     virtual void myPushBack(RawPtr rawf, ConstRawPtr rawc, const std::vector<long>& expv) const = 0; /// SHOULD BE vector<BigInt> ????
93     virtual void myPushFront(RawPtr rawf, ConstRawPtr rawc, PPMonoidElemConstRawPtr rawpp) const = 0;
94     virtual void myPushBack(RawPtr rawf, ConstRawPtr rawc, PPMonoidElemConstRawPtr rawpp) const = 0;
95     //@}
96 
97     ///@name functions inherited from PolyRing with a unique implementation for all SparsePolyRing implementations
98     //@{
99     virtual long myStdDeg(ConstRawPtr rawf) const;              ///< returns standard degree of f
100     virtual long myDeg(ConstRawPtr rawf, long index) const;  ///< returns the degree of f in x[index]
101     virtual void myContent(RawPtr rawcontent, ConstRawPtr rawf) const; ///< exception clean
102     virtual void myContentFrF(RawPtr rawcontent, ConstRawPtr rawf) const; ///< exception clean
103     virtual void myCommonDenom(RawPtr rawcontent, ConstRawPtr rawf) const; ///< exception clean
104     virtual void myClearDenom(RawPtr rawres, ConstRawPtr rawf) const; ///< exception clean
105     virtual void myRemoveBigContent(RawPtr rawf) const;                ///< exception guarantee: same as myDivByCoeff
106     virtual bool myIsValid(ConstRawPtr rawf) const;                    ///< true iff f is a valid representation, for debugging
myIndetSymbol(long idx)107     virtual const symbol& myIndetSymbol(long idx) const {return myPPM()->myIndetSymbol(idx);}
108     //@}
109 
110     ///@name functions inherited from ring with a unique implementation for all SparsePolyRing implementations
111     //@{
112     using PolyRingBase::myOutputSelf; // disable warnings of overloading
113     virtual void myOutputSelf(OpenMathOutput& OMOut) const;
114     virtual void myMul(RawPtr rawlhs, ConstRawPtr rawx, ConstRawPtr rawy) const; ///< lhs = x*y
115     //    virtual void myDiv(RawPtr rawlhs, ConstRawPtr rawx, ConstRawPtr rawy) const; ///< lhs = x/y
116     virtual bool myIsDivisible(RawPtr rawlhs, ConstRawPtr rawx, ConstRawPtr rawy) const; ///< lhs = x/y, if divisible
117     virtual void myDeriv(RawPtr rawlhs, ConstRawPtr rawf, ConstRawPtr rawx) const; ///< lhs = deriv(f, x)
118     virtual void mySymbols(std::vector<symbol>& SymList) const;            ///< append symbols in ring to SymList
119     virtual RingElem mySymbolValue(const symbol& sym) const;               ///< returns the RingElem corresponding to sym
120     virtual void myOutput(std::ostream& out, ConstRawPtr rawx) const;      ///< out << x
121     virtual bool myIsPrintAtom(ConstRawPtr rawx) const;                    ///< x^n may be printed without parentheses
122     virtual bool myIsPrintedWithMinus(ConstRawPtr rawx) const;             ///< x^n may be printed without parentheses
123     virtual void myOutput(OpenMathOutput& OMOut, ConstRawPtr rawx) const;  ///< OMOut << x
124     virtual bool myIsOne(ConstRawPtr rawf) const;                          ///< true iff rawf == 1
125     virtual bool myIsMinusOne(ConstRawPtr rawf) const;                     ///< true iff rawf == -1
126     virtual bool myIsConstant(ConstRawPtr rawf) const;                     ///< true iff rawf == c (possibly 0)
127     virtual bool myIsIndet(long& IndetIndex, ConstRawPtr rawf) const;      ///< true iff rawf is x[IndetIndex]
128     virtual bool myIsIndetPosPower(long& IndetIndex, BigInt& EXP, ConstRawPtr rawf) const;                ///< true iff rawf is x[i]^EXP for i=IndexIndex and EXP>0
129     virtual bool myIsIndetPosPower(ConstRawPtr rawf) const;                ///< true iff rawf is x[i]^d for some i and d>0
130     virtual bool myIsEvenPoly(ConstRawPtr rawf) const;
131     virtual bool myIsOddPoly(ConstRawPtr rawf) const;
132     virtual bool myIsInvertible(ConstRawPtr rawx) const;                   ///< true iff x is invertible
133     virtual bool myIsZeroDivisor(ConstRawPtr rawx) const;
134     virtual void myGcd(RawPtr rawlhs, ConstRawPtr rawx, ConstRawPtr rawy) const; ///< lhs = gcd(x,y) if TrueGCDDomain;
135     virtual void myNormalizeFracNoGcd(RawPtr rawnum, RawPtr rawden) const; ///< normalize fraction num/den
136     virtual bool myIsInteger(BigInt& N, ConstRawPtr rawx) const;           ///< true iff x is integer
137     virtual bool myIsRational(BigRat& Q, ConstRawPtr rawx) const;          ///< true iff x is rational
138     virtual ideal myIdealCtor(const std::vector<RingElem>& gens) const;
139     virtual void mySquare(RawPtr rawlhs, ConstRawPtr rawx) const;          ///< lhs = x^2
140     virtual void myPowerSmallExp(RawPtr rawlhs, ConstRawPtr rawx, long n) const; ///< lhs = x^n, n>1, x not -1,0,1
141     //@}
142 
143     ///@name  Functions for homomorphisms
144     //@{
145     virtual RingHom myCoeffEmbeddingHomCtor() const;
146     RingHom myHomCtor(const ring& codomain, const RingHom& CoeffHom, const std::vector<RingElem>& IndetImages) const;
147     RingHom myCompose(const RingHom& phi, const RingHom& theta) const;
148 
149     virtual bool myImageLiesInSubfield(const RingHom& phi) const;
150     //@}
151 
152     ///@name Special functions on polynomials needed for implementing Buchberger's Algorithm
153     //@{
154     virtual bool myIsZeroAddLCs(RawPtr rawf, RawPtr rawg) const = 0; ///< f+=LM(g); g-=LM(g); assumes LPP(f)==LPP(g); returns LC(f)+LC(g)==0
155     virtual void myMoveLMToFront(RawPtr rawf, RawPtr rawg) const = 0; ///< f+=LM(g); g-=LM(g); assumes LM(f)<LM(g)
156     virtual void myMoveLMToBack(RawPtr rawf, RawPtr rawg) const = 0; ///< f+=LM(g); g-=LM(g); assumes last PP of f>LM(g)
157     virtual void myDeleteLM(RawPtr rawf) const = 0;            // ????? right interface
158     virtual void myDivLM(RawPtr rawlhs, ConstRawPtr rawf, ConstRawPtr rawg) const = 0; ///< lhs=div(LM(f),LM(g)); assumes f!=0,g!=0
159     virtual int  myCmpLPP(ConstRawPtr rawf, ConstRawPtr rawg) const = 0; ///< cmp(LPP(f),LPP(g)); assumes f!=0,g!=0
160     virtual void myAddClear(RawPtr rawf, RawPtr rawg) const = 0;     ///< f+=g; g=0;
161     virtual void myAppendClear(RawPtr rawf, RawPtr rawg) const = 0;  ///< f+=g; g=0; appends g to f with no checks
162 
163     enum SkipLMFlag { SkipLMg, DontSkipLMg }; // used only for AddMul
164     virtual void myAddMulLM(RawPtr rawf, ConstRawPtr rawh, ConstRawPtr rawg) const = 0; ///<  f += LM(h)*g
165     virtual void myAddMulLM(RawPtr rawf, ConstRawPtr rawh, ConstRawPtr rawg, SkipLMFlag) const = 0; ///<  f += LM(h)*g
166     virtual void myReductionStep(RawPtr rawf, ConstRawPtr rawg) const = 0;
167     // ??? aggiungere coefficiente
168     virtual void myReductionStepGCD(RawPtr rawf, ConstRawPtr rawg, RingElem& FScale) const = 0;
169     // should it all be in ReductionStep ??? ANNA
170     //@}
171 
172 // need to be friend for SparsePolyRingBase::IdealImpl::ourGetPtr(I);
173 // not nice, not nice... (AMB 2011-04-19)
174 //     friend bool HasGBasis(const ideal& I);
175 //     friend bool AreGensMonomial(const ideal& I);
176 //     friend bool AreGensSqFreeMonomial(const ideal& I);
177 //     friend void SetGBasisAsGens(const ideal& I);
178 //     friend const std::vector<RingElem>& MinGens(const ideal& I);
179 //     friend std::vector<RingElem> GBasisSelfSatCore(const ideal& I);
180 //     friend std::vector<RingElem> GBasisRealSolve(const ideal& I);
181 
182 
183     //  protected: // Ideal class for this type of ring.
184     //  now public!! is this OK, or just a workaround (ourGetPtr)? //AMB 2018-03
185 
186     //--- ideal --------------------------------
187     class IdealImpl: public IdealBase
188     {
189       friend const std::vector<RingElem>& GBasisByHomog(const ideal& I, const CpuTimeLimit&);
190       friend std::vector<RingElem> GBasisSelfSatCore(const ideal& I);
191       friend std::vector<RingElem> GBasisRealSolve(const ideal& I);
192       friend const std::vector<RingElem>& MinGens(const ideal& I);
193     public:
194       IdealImpl(const SparsePolyRing& P, const std::vector<RingElem>& gens);
195       // default copy ctor is OK
196       virtual IdealBase* myClone() const;
197 //???    virtual void swap(ideal& other);
198 
199       virtual const SparsePolyRing& myRing() const;
200       virtual bool IamZero() const;
201       // virtual bool IamOne() const;  // default impl
202       virtual bool IhaveMonomialGens() const;
203       virtual bool IhaveSqFreeMonomialGens() const;
204       virtual bool IhaveGBasis() const;
205       virtual void mySetGBasisAsGens() const;
206       virtual void myReset() const; // reset all member fields but myGens
207       virtual void myReduceMod(RingElemRawPtr rawx) const; // r elem of R, where I is ideal in R
208       virtual bool IhaveElem(RingElemConstRawPtr rawx) const;
209       virtual bool IamZeroDim() const;
210       virtual void myAdd(const ideal&);
211       virtual void myMul(const ideal&);
212       virtual void myIntersect(const ideal&);
213       virtual void myColon(const ideal&);
214       virtual void mySaturate(const ideal&);
215       virtual void myMinimalize();
216       virtual void myElim(const std::vector<RingElem>& ELimIndets);
217       virtual bool myDivMod(RingElemRawPtr rawlhs, RingElemConstRawPtr rawnum, RingElemConstRawPtr rawden) const; // lhs = num/den modulo the ideal  (lhs = 0 if quotient does not exist)
218       virtual const std::vector<RingElem>& myJanetBasis() const;
219 
220       virtual const std::vector<RingElem>& myGens() const; // gens as specified by user
221       virtual const std::vector<RingElem>& myTidyGens(const CpuTimeLimit&) const; // tidier set of gens
222 
223 
224       //--- involutive --------------------------------
225       // all the involutive bases stuff always with prefix Inv to avoid some naming collisions
226       virtual bool InvIamDeltaRegular() const;
227       virtual bool InvIamMonomial() const;
228       virtual bool InvIamHomogeneous() const;
229       virtual bool InvIamCohenMacaulay() const;
230       virtual void InvMultVars(std::map<PPMonoidElem, std::vector<bool> >& MultVars) const;
231       virtual void InvNonMultVars(std::map<PPMonoidElem, std::vector<bool> >& NonMultVars) const;
232       virtual void InvHilbertPol(RingElem& HilbertPol, ConstRefRingElem var) const;
233       virtual void InvHilbertSeries(RingElem& HilbertSeries, ConstRefRingElem var) const;
234       virtual void InvFirstSyzygy(FGModule& syz) const;
235       virtual long InvDimension() const;
236       virtual void InvComplementaryDecomposition(std::vector<std::pair<PPMonoidElem, std::vector<bool> > >& CompDecomp) const;
237       virtual long InvDepth() const;
238       virtual long InvProjDim() const;
239       virtual void InvSocle(std::vector<RingElem>& socle) const;
240       virtual void InvExtremalBettiNumbers(std::map<std::pair<long, long>, long>& ExtremalBettiNumbers) const;
241       virtual void InvRegularSequence(std::vector<RingElem>& RegSeq) const;
242       virtual void InvMaximalStronglyIndependentSet(std::vector<RingElem>& MaxSet) const;
243       virtual long InvRegularity() const;
244       virtual long InvSatiety() const;
245       virtual void InvSaturation(std::vector<RingElem>& saturation) const;
246 
247       //---- data members -----------------------------------------------
248     protected: // Data members of SparsePolyRingBase::IdealImpl
249       SparsePolyRing myP;
250       std::vector<RingElem> myGensValue;
251       SmartPtrIRC<Involutive::UniversalInvolutiveBasisContainer> myInvBasisContainerPtr;
252       mutable bool3 IhaveMonomialGens3Value; ///< the given gens are monomials
253       mutable bool3 IhaveSqFreeMonomialGens3Value; ///< the given gens are square free monomials
254       mutable bool IhaveGBasisValue;
255       mutable std::vector<RingElem> myGBasisValue;
256       mutable std::vector<RingElem> myMinGensValue;
257       //      mutable HPSeries myHPSeriesValue;
258 
259     protected: // Auxiliary functions.
260       virtual const std::vector<RingElem>& myGBasis(const CpuTimeLimit&) const;
261       virtual const std::vector<RingElem>& myGBasisByHomog(const CpuTimeLimit&) const;
262       virtual std::vector<RingElem> myGBasisSelfSatCore() const;
263       virtual std::vector<RingElem> myGBasisRealSolve() const;
264       virtual const std::vector<RingElem>& myMinGens() const;
265       virtual void myTestIsMaximal() const;
266       virtual void myTestIsPrimary() const;
267       virtual void myTestIsPrime() const;
268       virtual void myTestIsRadical() const;
269       virtual std::vector<ideal> myPrimaryDecomposition() const;
270 
271     private:
272       //-- 0 dimensional ideals ------------------
273       void myTestIsMaximal_0dim() const;
274       void myTestIsPrimary_0dim() const;
275       void myTestIsRadical_0dim() const;
276       ideal myRadical_0dimDRL() const;
277       std::vector<ideal> myPrimaryDecomposition_0dim() const;
278       void myPrimaryDecompositionCore_0dim(bool& IsCertified, std::vector<ideal>& Q) const;
279 
280       //--- monomial ideals ----------------------
281       const std::vector<RingElem>& myGBasis_MonId() const;
282       void myTestIsRadical_MonId() const;
283       ideal myRadical_MonId() const;
284       std::vector<ideal> myPrimaryDecomposition_MonId() const;
285       void myMul_MonId(const ideal&);
286       void myIntersect_MonId(const ideal&);
287       void myColon_MonId(const ideal&);
288       void myElim_MonId(const std::vector<RingElem>& ELimIndets);
289 
290     public:
291       static const SparsePolyRingBase::IdealImpl* ourGetPtr(const ideal& J);
292 
293     // need to be friend for SparsePolyRingBase::IdealImpl::myTestIsPrimary_0dim
294     friend bool IsPrimary_0dim(const ideal& I);
295     // need to be friend for SparsePolyRingBase::IdealImpl::myRadical_0dimDRL
296     friend ideal radical_0dimDRL(const ideal& I);
297     // need to be friend for SparsePolyRingBase::IdealImpl::myRadical_MonId
298     friend ideal radical_MonId(const ideal& I);
299     };  // class IdealImpl
300 
301 
302     //----- HomImpl ---------------------------------------------------
303   protected:  // General homomorphism class for this type of ring.
304 
305     class HomImpl: public RingHomBase
306     {
307     public:
308       HomImpl(const SparsePolyRing& domain, const ring& codomain, const RingHom& CoeffHom, const std::vector<RingElem>& IndetImages);
309       virtual void myApply(RingElemRawPtr rawimage, RingElemConstRawPtr rawarg) const;
IamPartial()310       virtual bool IamPartial() const { return IsPartial(myCoeffHom); }
311     private:
312       virtual void myOutputSelfDetails(std::ostream& out) const;
313 
314     private: // Data members of SparsePolyRingBase::HomImpl
315       const RingHom myCoeffHom;
316       const std::vector<RingElem> myIndetImages;
317     };  // class HomImpl
318 
319   protected:  // Special homomorphism class for this type of ring.
320 
321     class CoeffEmbeddingHomImpl: public RingHomEmbeddingBase
322     {
323     public:
324       CoeffEmbeddingHomImpl(const SparsePolyRing& P);
325       virtual void myApply(RingElemRawPtr rawimage, RingElemConstRawPtr rawarg) const;
326     };  // class CoeffEmbeddingHomImpl
327 
328   };
329 
330 
331   SparsePolyRing NewPolyRing(const ring& CoeffRing, const PPMonoid& PPM);
332   SparsePolyRing NewPolyRing(const ring& CoeffRing, const std::vector<symbol>& IndetNames, const PPOrdering& ord);
333   SparsePolyRing NewPolyRing(const ring& CoeffRing, const std::vector<symbol>& IndetNames, const PPOrderingCtor& ord);
334   SparsePolyRing NewPolyRing(const ring& CoeffRing, const std::vector<symbol>& IndetNames); ///< Default ordering is StdDegRevLex
335 
336   bool IsSparsePolyRing(const ring& R);                  // inline
337   const PPMonoid& PPM(const SparsePolyRing& Rx);         // inline
338   long GradingDim(const SparsePolyRing& Rx);             // inline
339   bool IsStdGraded(const SparsePolyRing& Rx);            // inline
340   ConstMatrixView OrdMat(const SparsePolyRing& Rx);
341   ConstMatrixView GradingMat(const SparsePolyRing& Rx);
342   bool HasPositiveGrading(const SparsePolyRing& Rx);
343 
344   bool AreGoodIndetNames(const ring& CoeffRing, const std::vector<symbol>& IndetNames);
345 
346 
347   //----------------------------------------------------------------------
348   // Inline functions
349 
SparsePolyRingPtr(const ring & R)350   inline const SparsePolyRingBase* SparsePolyRingPtr(const ring& R)
351   {
352     return dynamic_cast<const SparsePolyRingBase*>(R.myRawPtr());
353   }
354 
SparsePolyRingPtr(const ring & R,const char * const FnName)355   inline const SparsePolyRingBase* SparsePolyRingPtr(const ring& R, const char* const FnName)
356   {
357     const SparsePolyRingBase* ptr = SparsePolyRingPtr(R);
358     if (ptr == nullptr) CoCoA_ERROR(ERR::NotSparsePolyRing, FnName);
359     return ptr;
360   }
361 
IsSparsePolyRing(const ring & R)362   inline bool IsSparsePolyRing(const ring& R)
363   { return SparsePolyRingPtr(R) != nullptr; }
364 
365 
SparsePolyRing(const ring & R)366   inline SparsePolyRing::SparsePolyRing(const ring& R):
367       PolyRing(SparsePolyRingPtr(R, "SparsePolyRing ctor"))
368   {}
369 
SparsePolyRing(const SparsePolyRingBase * RingPtr)370   inline SparsePolyRing::SparsePolyRing(const SparsePolyRingBase* RingPtr):
371       PolyRing(RingPtr)
372   {}
373 
374 
375   inline const SparsePolyRingBase* SparsePolyRing::operator->() const
376   { return static_cast<const SparsePolyRingBase*>(ring::operator->()); }
377 
PPM(const SparsePolyRing & Rx)378   inline const PPMonoid& PPM(const SparsePolyRing& Rx)
379   { return Rx->myPPM(); }
380 
GradingDim(const SparsePolyRing & Rx)381   inline long GradingDim(const SparsePolyRing& Rx)
382   { return Rx->myGradingDim(); }
383 
IsStdGraded(const SparsePolyRing & Rx)384   inline bool IsStdGraded(const SparsePolyRing& Rx)
385   { return Rx->IamStdGraded(); }
386 
HasLex(const SparsePolyRing & P)387   inline bool HasLex(const SparsePolyRing& P)
388   { return IsLex(ordering(PPM(P))); }
389 
HasStdDegLex(const SparsePolyRing & P)390   inline bool HasStdDegLex(const SparsePolyRing& P)
391   { return IsStdDegLex(ordering(PPM(P))); }
392 
HasStdDegRevLex(const SparsePolyRing & P)393   inline bool HasStdDegRevLex(const SparsePolyRing& P)
394   { return IsStdDegRevLex(ordering(PPM(P))); }
395 
HasMatrixOrdering(const SparsePolyRing & P)396   inline bool HasMatrixOrdering(const SparsePolyRing& P)
397   { return IsMatrixOrdering(ordering(PPM(P))); }
398 
399 } // end of namespace CoCoA
400 
401 
402 
403 // RCS header/log in the next few lines
404 // $Header: /Volumes/Home_1/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/SparsePolyRing.H,v 1.128 2020/02/12 09:01:47 bigatti Exp $
405 // $Log: SparsePolyRing.H,v $
406 // Revision 1.128  2020/02/12 09:01:47  bigatti
407 // -- changed myTestIsMaximal etc to return void (and consequences)
408 //
409 // Revision 1.127  2019/12/28 17:55:49  abbott
410 // Summary: Added myIsIndetPosPower (with 3 args)
411 //
412 // Revision 1.126  2019/10/03 13:33:56  bigatti
413 // -- implemented radical for monomial ideals (and used where useful)
414 //
415 // Revision 1.125  2019/09/25 14:35:05  bigatti
416 // -- removed old commented out code about RingElem
417 //
418 // Revision 1.124  2019/09/25 14:28:30  bigatti
419 // -- added HasPositiveGrading
420 //
421 // Revision 1.123  2019/09/16 17:41:41  abbott
422 // Summary: Added myIsEvenPoly, myIsOddPoly
423 //
424 // Revision 1.122  2019/03/18 17:13:25  abbott
425 // Summary: Used nullptr instead of 0
426 //
427 // Revision 1.121  2018/10/02 09:45:30  abbott
428 // Summary: Moved pseudo-ctors NewPolyRing(CoeffRing, NumIndets, ...) to obsolescent
429 //
430 // Revision 1.120  2018/09/28 15:54:04  abbott
431 // Summary: Removed pseudo-ctors NewPolyRing which took just num of indets; now must specify their names
432 //
433 // Revision 1.119  2018/08/06 09:38:29  bigatti
434 // -- renamed GBasisViaHomog --> GBasisByHomog
435 //
436 // Revision 1.118  2018/08/06 08:57:48  bigatti
437 // -- added timeout for GBasisViaHomog
438 // -- now using GBasisViaHomog in IsPrimary and radical
439 //
440 // Revision 1.117  2018/06/27 12:15:18  abbott
441 // Summary: Renamed RealSolveCore to RealSolve
442 //
443 // Revision 1.116  2018/06/15 08:48:46  abbott
444 // Summary: Added NewPolyRing with args CoeffRing, NumIndets, PPord
445 //
446 // Revision 1.115  2018/05/25 09:24:46  abbott
447 // Summary: Major redesign of CpuTimeLimit (many consequences)
448 //
449 // Revision 1.114  2018/05/18 16:34:52  bigatti
450 // -- split SparsePolyOps-RingElem from SparsePolyRing
451 //
452 // Revision 1.113  2018/05/17 15:22:21  bigatti
453 // -- SparsePolyIter separated from SparsePolyRing
454 //
455 // Revision 1.112  2018/04/16 21:46:16  bigatti
456 // -- added IamZeroDim
457 // -- added myPrimaryDecomposition_0dim
458 //
459 // Revision 1.111  2018/04/10 14:51:44  bigatti
460 // -- added virtual myPrimaryDecomposition (with default implementation)
461 //
462 // Revision 1.110  2018/04/10 14:20:10  bigatti
463 // -- started work on primary decomposition
464 //
465 // Revision 1.109  2018/03/29 09:36:40  bigatti
466 // -- added member functions myTestIsRadical, myTestIsPrimary and flags
467 //
468 // Revision 1.108  2018/03/20 11:39:56  bigatti
469 // -- changed ***MonId --> ***_MonId
470 //
471 // Revision 1.107  2018/03/20 11:20:44  bigatti
472 // -- changes names IamRadicalOdimDRL --> myTestIsRadical_0dimDRL (etc)
473 //
474 // Revision 1.106  2018/03/15 14:21:55  bigatti
475 // -- new files SparsePolyOps-ideal.H and SparsePolyOps-involutive.H
476 //
477 // Revision 1.105  2017/11/29 17:40:59  bigatti
478 // -- added GBasisRealSolveCore
479 // -- changed GBasisSelfSatCore: now DOES NOT store GBasis
480 //
481 // Revision 1.104  2017/11/24 17:46:40  bigatti
482 // -- renamed GBasisSelfSat --> GBasisSelfSatCore
483 // -- added GBasisSelfSat in cpkg5
484 //
485 // Revision 1.103  2017/11/23 12:32:28  bigatti
486 // -- added GBasisSelfSat
487 //
488 // Revision 1.102  2017/09/25 12:36:58  abbott
489 // Summary: Added QuotientBasisSorted
490 //
491 // Revision 1.101  2017/07/23 15:31:33  abbott
492 // Summary: Added GBasisTimeout (just for ideals)
493 //
494 // Revision 1.100  2017/07/03 19:52:37  abbott
495 // Summary: Added CutLF
496 //
497 // Revision 1.99  2017/04/26 15:56:00  bigatti
498 // -- added IdealOfGBasis, IdealOfMinGens
499 //
500 // Revision 1.98  2017/03/08 15:33:15  bigatti
501 // -- just some comments on "sections" (removed doxygen)
502 //
503 // Revision 1.97  2016/11/18 18:08:29  abbott
504 // Summary: Reordered prototypes for some monomial fns
505 //
506 // Revision 1.96  2016/11/07 13:54:21  bigatti
507 // ++ added AreGensSqFreeMonomial
508 // ++ replaced all SquareFree into SqFree
509 //
510 // Revision 1.95  2016/11/07 12:11:21  bigatti
511 // -- added HasGBasis / IhaveGBasis
512 //
513 // Revision 1.94  2016/10/27 13:55:47  bigatti
514 // -- added myRadicalMonId
515 //
516 // Revision 1.93  2016/09/08 14:01:28  bigatti
517 // -- added test functions for maximal and radical
518 //
519 // Revision 1.92  2016/06/29 13:13:49  abbott
520 // Summary: Changed/corrected rtn type of SparsePolyRingPtr
521 //
522 // Revision 1.91  2016/06/24 14:27:41  bigatti
523 // -- renamed CRT_poly --> CRTPoly
524 //
525 // Revision 1.90  2016/04/27 06:59:53  bigatti
526 // -- new: myReset()
527 // -- removed: myClearGBasis()
528 //
529 // Revision 1.89  2016/04/07 14:35:45  abbott
530 // Summary: Removed code which disabled assignment of rings
531 //
532 // Revision 1.88  2015/12/08 13:56:09  abbott
533 // Summary: Updated Mario's code!  Very many changes!
534 //
535 // Revision 1.87  2015/11/30 21:53:55  abbott
536 // Summary: Major update to matrices for orderings (not yet complete, some tests fail)
537 //
538 // Revision 1.86  2015/10/01 10:13:10  bigatti
539 // -- added CRT_poly, RatReconstructPoly
540 //
541 // Revision 1.85  2015/06/30 12:51:10  abbott
542 // Summary: Added new fn IndetsIn
543 // Author: JAA
544 //
545 // Revision 1.84  2015/06/11 16:55:16  bigatti
546 // -- added monomial(ring, pp) and monomial(ring, expv)
547 //
548 // Revision 1.83  2015/04/30 08:44:18  bigatti
549 // -- added myIsZeroDivisor
550 // -- removed some newlines in function definition
551 //
552 // Revision 1.82  2015/04/24 15:40:59  bigatti
553 // -- renamed: myAddMul --> myAddMulLM
554 // -- renamed: myMoveLM --> myMoveLMToFront
555 // -- new myMoveLMToBack (used in ReductionCog --> bug in test-TmpMorseGraph??)
556 //
557 // Revision 1.81  2014/07/31 13:10:46  bigatti
558 // -- GetMatrix(PPO) --> OrdMat(PPO)
559 // -- added OrdMat and GradingMat to PPOrdering, PPMonoid, SparsePolyRing
560 //
561 // Revision 1.80  2014/07/30 14:01:14  abbott
562 // Summary: Changed myAmbientRing into myRing
563 // Author: JAA
564 //
565 // Revision 1.79  2014/07/28 15:41:47  abbott
566 // Summary: Added myCoeffEmbeddingHomCtor
567 // Author: JAA
568 //
569 // Revision 1.78  2014/07/11 15:42:54  bigatti
570 // -- added  myOutputSelf (default impl),  myImplDetails()
571 //
572 // Revision 1.77  2014/07/07 17:11:57  abbott
573 // Summary: [MAJOR CHANGE] Removed AsSparsePolyRing; added SparsePolyRingPtr
574 // Author: JAA
575 //
576 // Revision 1.76  2014/05/06 13:20:41  abbott
577 // Summary: Changed names (my)MaxExponents into (my)Deg
578 // Author: JAA
579 //
580 // Revision 1.75  2014/04/15 13:28:55  abbott
581 // Summary: Added new ClearDenom fn (with 2 args)
582 // Author: JAA
583 //
584 // Revision 1.74  2014/03/27 14:57:23  bigatti
585 // -- added myMinimalize
586 //
587 // Revision 1.73  2014/01/28 13:08:32  bigatti
588 // -- added LF for ideal
589 //
590 // Revision 1.72  2013/07/30 15:01:51  bigatti
591 // -- added IsStdGraded
592 // -- removed empty lines in inline functions
593 //
594 // Revision 1.71  2013/06/28 17:03:51  abbott
595 // Modified semantics of IdealBase::myDivMod;
596 // it now returns a boolean.
597 // Several consequential changes.
598 //
599 // Revision 1.70  2013/06/12 08:49:17  bigatti
600 // -- added MinGens
601 //
602 // Revision 1.69  2013/05/30 13:13:58  bigatti
603 // -- added SetGBasisAsGens
604 //
605 // Revision 1.68  2013/05/28 13:29:54  abbott
606 // Added printing for struct CoeffPP.
607 //
608 // Revision 1.67  2013/02/21 12:50:44  abbott
609 // Added new fn UnivariateIndetIndex.
610 //
611 // Revision 1.66  2013/01/21 14:07:08  bigatti
612 // -- commented out "IamPartial"  (for the time being)
613 //
614 // Revision 1.65  2013/01/17 15:11:19  abbott
615 // Added new fn CoeffVecWRT.
616 // Added new virt mem fns myImageLiesInSubfield & IamPartial.
617 //
618 // Revision 1.64  2012/10/24 13:31:08  abbott
619 // Changed return type of coeff/myCoeff.
620 // Minor change to signature of CoefficientsWRT & ContentWRT.
621 //
622 // Revision 1.63  2012/10/17 09:40:16  abbott
623 // Replaced  RefRingElem  by  RingElem&
624 // (plus a few consequential changes)
625 //
626 // Revision 1.62  2012/10/05 10:21:39  bigatti
627 // -- added LF (leading form)
628 //
629 // Revision 1.61  2012/10/02 16:44:04  bigatti
630 // -- added homog for ideal
631 //
632 // Revision 1.60  2012/05/30 13:44:11  bigatti
633 // -- renamed IhaveMonomialGensB3Value --> IhaveMonomialGens3Value
634 //
635 // Revision 1.59  2012/05/22 10:02:37  abbott
636 // Removed IsGCDDomain; substituted by IsTrueGCDDomain.
637 // Added IsFractionFieldOfGCDDomain.
638 //
639 // Revision 1.58  2012/04/03 16:12:46  abbott
640 // Changed slightly the fn signatures of CoefficientsWRT.
641 // Added some things to *.C file -- will complete later.
642 //
643 // Revision 1.57  2012/03/02 14:21:46  bigatti
644 // -- added ContentWRT, CoefficientsWRT(f, x)
645 //
646 // Revision 1.56  2012/02/10 17:09:38  abbott
647 // Added new fns  indets, CoefficientsWRT, ContentWRT.
648 //
649 // Revision 1.55  2011/11/09 13:50:01  bigatti
650 // -- renamed MachineInteger --> MachineInt
651 //
652 // Revision 1.54  2011/08/24 10:21:09  bigatti
653 // -- renamed QQ --> BigRat
654 //
655 // Revision 1.53  2011/08/14 15:52:17  abbott
656 // Changed ZZ into BigInt (phase 1: just the library sources).
657 //
658 // Revision 1.52  2011/07/05 15:02:17  bigatti
659 // -- added AlexanderDual
660 // -- added ad-hoc functions for colon, elim on monomial ideals
661 //
662 // Revision 1.51  2011/06/27 13:30:38  bigatti
663 // -- new file for monomial ideals:
664 // -- some functions moved there, but some have to be declared in SparsePolyRing.H
665 //
666 // Revision 1.50  2011/06/23 16:04:47  abbott
667 // Added IamExact mem fn for rings.
668 // Added myRecvTwinFloat mem fn for rings.
669 // Added first imple of RingHom from RingTwinFloat to other rings.
670 //
671 // Revision 1.49  2011/05/20 16:04:31  bigatti
672 // -- added QuotientBasis
673 //
674 // Revision 1.48  2011/05/19 13:56:12  abbott
675 // Removed comment out decl of old form of myIsRational.
676 //
677 // Revision 1.47  2011/04/19 13:59:49  bigatti
678 // -- added AreGensMonomial
679 //
680 // Revision 1.46  2011/04/12 09:52:15  bigatti
681 // -- added IsHomog(ideal), LT(ideal)
682 //
683 // Revision 1.45  2011/03/16 15:39:44  bigatti
684 // -- added myIsIndetPosPower(f), IsIndetPosPower(f)
685 //
686 // Revision 1.44  2011/03/16 13:21:23  abbott
687 // Added comments for myIsHomogPartial & myCmpWDegPartial.
688 // Cleaned up impls of myIsHomog & myIsHomogPartial.
689 // Corrected typo in impl of myElim.
690 //
691 // Revision 1.43  2011/03/11 10:53:38  bigatti
692 // -- added mySaturate
693 //
694 // Revision 1.42  2011/03/10 16:39:35  abbott
695 // Replaced (very many) size_t by long in function interfaces (for rings,
696 // PPMonoids and modules).  Also replaced most size_t inside fn defns.
697 //
698 // Revision 1.41  2011/03/01 14:10:47  bigatti
699 // -- added ClearDenom/myClearDenom
700 //
701 // Revision 1.40  2011/02/28 14:16:08  bigatti
702 // -- added GBasis(ideal)  -- only for SparsePolyRing
703 // -- error for myGcd when CoeffRing is not a field
704 //
705 // Revision 1.39  2011/01/28 17:58:07  bigatti
706 // -- added myElim
707 //
708 // Revision 1.38  2011/01/28 11:41:42  bigatti
709 // -- added IsPrintedWithMinus
710 // -- improved myOutput
711 // -- fixed bug in IsMinusOne
712 //
713 // Revision 1.37  2011/01/18 14:35:38  bigatti
714 // -- moved **_forC5 functions into CoCoA-5/CoCoALibSupplement:
715 //    myMonomials_forC5, mySupport_forC5, monomials_forC5, support_forC5,
716 //    LPP_forC5, LT_forC5, LM_forC5
717 //
718 // Revision 1.36  2010/11/30 11:34:37  bigatti
719 // -- added virtual myIndetSymbol
720 //
721 // Revision 1.35  2010/11/25 12:30:49  bigatti
722 // -- added myIndetsCalled
723 //
724 // Revision 1.34  2010/11/05 16:10:58  bigatti
725 // -- added myMonomials_forC5, mySupport_forC5
726 //
727 // Revision 1.33  2010/10/01 15:20:33  bigatti
728 // -- added mySymbolValue
729 // -- added RingElem(R, sym)
730 //
731 // Revision 1.32  2010/09/02 13:06:52  bigatti
732 // -- changed comment "fwd decl"
733 //
734 // Revision 1.31  2010/07/14 09:00:44  bigatti
735 // -- added comment
736 //
737 // Revision 1.30  2010/07/13 12:50:55  bigatti
738 // -- added comment
739 //
740 // Revision 1.29  2010/06/10 08:00:02  bigatti
741 // -- fixed naming conventions
742 //
743 // Revision 1.28  2010/03/18 13:55:56  abbott
744 // Added pseudo-ctors for monomials with BigRat coeffs.
745 //
746 // Revision 1.27  2010/03/05 18:43:48  abbott
747 // Added pseudo-ctors allowing polynomial rings to be created specifying
748 // the ordering using a PPOrderingCtor object.
749 //
750 // Revision 1.26  2010/02/04 09:57:11  bigatti
751 // -- added "mul" for ideals.  Implemented only for SparsePolyRing
752 //
753 // Revision 1.25  2010/01/21 14:12:28  bigatti
754 // -- swapped position of IhaveMonomialGens and myGBasisIsValid
755 //
756 // Revision 1.24  2009/11/26 17:21:34  bigatti
757 // -- added PushFront/PushBack(f, c, pp)
758 // -- added in .C inline functions:
759 // --   CheckCompatible, CheckElemSparsePolyRing, CheckCoeffExpv, CheckCoeffPP
760 //
761 // Revision 1.23  2009/10/02 13:27:26  bigatti
762 // -- unique implementation of myDiv in PolyRing.C
763 //
764 // Revision 1.22  2009/09/28 16:19:43  bigatti
765 // -- unique implementation for myDeriv
766 //
767 // Revision 1.21  2009/09/25 13:02:09  bigatti
768 // -- myDiv with one implementation in SparsePolyRing
769 //
770 // Revision 1.20  2009/09/22 14:07:33  bigatti
771 // -- added CmpWDegPartial and IsHomogPartial
772 //
773 // Revision 1.19  2009/07/24 12:26:43  abbott
774 // Added CommonDenom function for polynomials.
775 //
776 // Revision 1.18  2009/07/02 16:32:11  abbott
777 // Consequential changes stemming from new class BigRat, and modified interface to the member
778 // function RingBase::myIsRational.  Also some new conversion functions.
779 //
780 // Revision 1.17  2008/12/17 12:11:52  abbott
781 // Changed type from long to MachineInt in operations which use a machine integer
782 // in place of a RingElem.  The change is "superficial" but affects many files.
783 //
784 // Revision 1.16  2008/11/18 15:20:10  bigatti
785 // -- added const to myGBasis return value
786 // -- added myIdealCtor to RingWeyl for proper inheritance
787 //
788 // Revision 1.15  2008/10/09 15:15:05  bigatti
789 // -- added "bool3 IhaveMonomialGensValue" member field for ideals
790 //
791 // Revision 1.14  2008/04/21 12:32:54  abbott
792 // Corrected size_t into std::size_t in several header files; in some cases,
793 // replaced size_t with MachineInt (with consequent changes to impl files).
794 //
795 // Revision 1.13  2008/04/15 14:54:28  bigatti
796 // -- added mySquare
797 //
798 // Revision 1.12  2008/04/10 15:00:24  bigatti
799 // -- added  myPushBack/Front(RawPtr, ConstRawPtr, PPMonoidElemConstRawPtr)
800 //
801 // Revision 1.11  2008/03/12 16:35:18  bigatti
802 // -- changed: IsHomogeneous --> IsHomog
803 // -- changed: ERR:ZeroPoly --> ERR::ZeroRingElem
804 //
805 // Revision 1.10  2007/12/07 15:27:01  bigatti
806 // -- default implementation of "IamOne" in ideal.C
807 //
808 // Revision 1.9  2007/12/05 11:06:24  bigatti
809 // -- changed "size_t StdDeg/myStdDeg(f)" into "long"  (and related functions)
810 // -- changed "log/myLog(f, i)" into "MaxExponent/myMaxExponent(f, i)"
811 // -- fixed bug in "IsOne(ideal)" in SparsePolyRing.C
812 //
813 // Revision 1.8  2007/10/30 17:14:11  abbott
814 // Changed licence from GPL-2 only to GPL-3 or later.
815 // New version for such an important change.
816 //
817 // Revision 1.7  2007/10/05 15:17:13  bigatti
818 // -- just a proper sorting on functions
819 //
820 // Revision 1.6  2007/05/31 16:31:53  bigatti
821 // -- adjusted comments
822 //
823 // Revision 1.5  2007/05/31 15:43:56  bigatti
824 // -- added mySymbols and AreGoodIndetNames
825 //
826 // Revision 1.3  2007/05/22 22:45:14  abbott
827 // Changed fn name IsUnit to IsInvertible.
828 //
829 // Revision 1.2  2007/03/12 16:00:29  bigatti
830 // -- moved myLog(F, index) into unique implementation in SparsePolyRing
831 //
832 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
833 // Imported files
834 //
835 // Revision 1.23  2007/03/08 18:42:05  cocoa
836 // Cleaned up whitespace.
837 //
838 // Revision 1.22  2007/03/08 11:07:12  cocoa
839 // Made pseudo ctors for polynomial rings more uniform.  This allowed me to
840 // remove an include of CoCoA/symbol.H  from the RingDistrM*.H files, but then
841 // I had to put the include in several .C files.
842 //
843 // Revision 1.21  2007/02/10 18:44:03  cocoa
844 // Added "const" twice to each test and example.
845 // Eliminated dependency on io.H in several files.
846 // Improved BuildInfo, and added an example about how to use it.
847 // Some other minor cleaning.
848 //
849 // Revision 1.20  2007/01/20 14:07:25  bigatti
850 // -- moved code for homomorphism into common implementation in SparsePolyRing
851 //
852 // Revision 1.19  2007/01/15 13:33:34  cocoa
853 // -- added prefix "raw" to RawPtr arguments names
854 //
855 // Revision 1.18  2006/12/07 17:36:19  cocoa
856 // -- migrated  myRemoveBigContent myContent myPowerSmallExp  into
857 //    single implementation in SparsePolyRing
858 // -- removed  content  from DistrMPoly(..)
859 //
860 // Revision 1.17  2006/12/06 17:25:43  cocoa
861 // -- removed #include "config.H"
862 //
863 // Revision 1.16  2006/11/23 17:43:53  cocoa
864 // -- minor change
865 //
866 // Revision 1.15  2006/11/22 17:51:31  cocoa
867 // -- moved printing functions into unified implementation in SparsePolyRing
868 //
869 // Revision 1.14  2006/11/21 18:09:24  cocoa
870 // -- added myIsMonomial
871 // -- implemented myIsOne, myIsMinusOne, myIsConstant, myIsIndet in SparsePolyRing
872 // -- removed the 4 functions from DistrMPoly(..) and RingDistrMPoly(..)
873 // -- changed all names of RawPtr arguments into "raw(..)"
874 //
875 // Revision 1.13  2006/11/20 15:55:02  cocoa
876 // ring is now a class again.  Improved definitions of operator-> in derived classes.
877 //
878 // Revision 1.12  2006/11/14 17:36:49  cocoa
879 // -- fixed implementation for ideal in RingWeyl
880 //
881 // Revision 1.11  2006/11/09 17:46:58  cocoa
882 // -- version 0.9712:
883 // --   IdealImpl moved to SparsePolyRing from concrete rings
884 // -- PolyList in GTypes is now vector<RingElem> (was list)
885 // -- "my" coding convention applied to DistrMPoly
886 //
887 // Revision 1.10  2006/11/03 14:01:46  cocoa
888 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
889 //    uses SmartPtrIRC
890 //
891 // Revision 1.9  2006/11/02 13:25:44  cocoa
892 // Simplification of header files: the OpenMath classes have been renamed.
893 // Many minor consequential changes.
894 //
895 // Revision 1.8  2006/10/06 14:04:15  cocoa
896 // Corrected position of #ifndef in header files.
897 // Separated CoCoA_ASSERT into assert.H from config.H;
898 // many minor consequential changes (have to #include assert.H).
899 // A little tidying of #include directives (esp. in Max's code).
900 //
901 // Revision 1.7  2006/08/17 09:45:07  cocoa
902 // -- added: homogenization
903 //
904 // Revision 1.6  2006/08/07 21:23:25  cocoa
905 // Removed almost all publicly visible references to SmallExponent_t;
906 // changed to long in all PPMonoid functions and SparsePolyRing functions.
907 // DivMask remains to sorted out.
908 //
909 // Revision 1.5  2006/07/20 17:06:08  cocoa
910 // -- moved myStdDeg into SparsePolyRing
911 //
912 // Revision 1.4  2006/07/20 16:51:38  cocoa
913 // -- added common implementation of myStdDeg
914 //
915 // Revision 1.3  2006/07/17 11:05:53  cocoa
916 // -- added: myIsValid, myIsHomogeneous, IsHomogeneous
917 //
918 // Revision 1.2  2006/06/08 16:45:28  cocoa
919 // -- RingDistrMPoly*.H  have been "moved" into RingDistrMPoly*.C
920 // -- some coding conventions fixed in DistrMPoly*
921 // -- functions wdeg and CmpWDeg have a common implementation in SparsePolyRing
922 //
923 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
924 // Imported files
925 //
926 // Revision 1.10  2006/05/29 16:22:37  cocoa
927 // Third time lucky???
928 // Added myIsInteger member function to all rings (NYI for RingFloat).
929 //
930 // Revision 1.9  2006/05/12 17:01:28  cocoa
931 // -- added myIsUnit, myGcd whose implementation in RingDistr*** were identical
932 //
933 // Revision 1.8  2006/04/27 13:06:19  cocoa
934 // -- just spaces
935 //
936 // Revision 1.7  2006/04/26 16:44:53  cocoa
937 // -- myMul has now a single implementation in SparsePolyRing
938 // -- myMul and mul in RingDistrMPoly* and DistrMPoly* have been disabled
939 //
940 // Revision 1.6  2006/04/21 14:58:04  cocoa
941 // Removed myWDeg member function: it is no longer needed.
942 //
943 // Revision 1.5  2006/03/17 18:13:25  cocoa
944 // -- changed: myMul --> myMulByPP
945 //
946 // Revision 1.4  2006/03/12 21:28:34  cocoa
947 // Major check in after many changes
948 //
949 // Revision 1.3  2006/03/07 10:11:06  cocoa
950 // -- fixed:  PPMonoidElem myLPP/LPP now return ConstRefPPMonoidElem
951 //
952 // Revision 1.2  2006/01/19 16:34:42  cocoa
953 // -- added NF, myReduceMod functions (not yet tested)
954 //
955 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
956 // Imported files
957 //
958 // Revision 1.5  2005/09/30 15:03:39  cocoa
959 // Minor cleaning and tidying.
960 // DistrMPolyInlPP: use of summands now rather cleaner.
961 //
962 // Revision 1.4  2005/08/08 16:36:32  cocoa
963 // Just checking in before going on holiday.
964 // Don't really recall what changes have been made.
965 // Added IsIndet function for RingElem, PPMonoidElem,
966 // and a member function of OrdvArith.
967 // Improved the way failed assertions are handled.
968 //
969 // Revision 1.3  2005/07/19 15:30:20  cocoa
970 // A first attempt at iterators over sparse polynomials.
971 // Main additions are to SparsePolyRing, DistrMPoly*.
972 // Some consequential changes to PPMonoid*.
973 //
974 // Revision 1.2  2005/07/15 16:34:33  cocoa
975 // Added iterators for sparse polynomials.
976 // The code compiles (and the old tests still run).
977 // It'd Friday evening -- I'm going home before
978 // getting any ideas about making the iterator code run.
979 //
980 // Revision 1.1  2005/07/01 16:08:16  cocoa
981 // Friday check-in.  Major change to structure under PolyRing:
982 // now SparsePolyRing and DUPolyRing are separated (in preparation
983 // for implementing iterators).
984 //
985 // A number of other relatively minor changes had to be chased through
986 // (e.g. IndetPower).
987 //
988 
989 #endif
990