1 #ifndef CoCoA_error_H
2 #define CoCoA_error_H
3 
4 //   Copyright (c)  2005-2017  John Abbott and Anna M. Bigatti
5 //   Authors:  2005-2010  John Abbott, 2010-2017 John Abbott, Anna M. Bigatti
6 
7 //   This file is part of the source of CoCoALib, the CoCoA Library.
8 
9 //   CoCoALib is free software: you can redistribute it and/or modify
10 //   it under the terms of the GNU General Public License as published by
11 //   the Free Software Foundation, either version 3 of the License, or
12 //   (at your option) any later version.
13 
14 //   CoCoALib is distributed in the hope that it will be useful,
15 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 //   GNU General Public License for more details.
18 
19 //   You should have received a copy of the GNU General Public License
20 //   along with CoCoALib.  If not, see <http://www.gnu.org/licenses/>.
21 
22 
23 
24 // All errors should be thrown by calling the function "error"
25 // as this makes debugging easier and doesn't adversely affect
26 // run-time performance.  The function "error" will print a brief
27 // message if CoCoA_DEBUG is set, and it will throw the error object.
28 
29 
30 #include "CoCoA/exception.H"
31 
32 #include <string>
33 //using std::string;
34 #include <iosfwd>
35 //using std::ostream;
36 
37 // UGLY WORKAROUND FOR SOLARIS BUG!!!
38 // (some header file defines the preprocessor symbol ERR to be 13)
39 #if defined(ERR)
40 #  undef ERR
41 #endif
42 
43 
44 namespace CoCoA
45 {
46 
47   namespace ERR
48   {
49     struct ID
50     {
IDID51       ID(const char* const ErrName, const char* const DefaultMesg): myName(ErrName), myDefaultMesg(DefaultMesg) {};
52       bool operator<(const ID& rhs) const;
53       bool operator==(const ID& rhs) const;
54       bool operator!=(const ID& rhs) const;
55       const char* const myName;
56       const char* const myDefaultMesg;
57     };
58 
59     extern const ID
60             LANGUAGE,          // Not really an error message, just the name of the language
61             nonstandard,       // To create a nonstandard error message
62             UNKNOWN,           // To signal an error of unknown type -- can this ever be used???
63             ArgTooBig,         // Argument too large in a numerical function
64             AssertFail,        // An assertion failed
65             BadArg,            // The arg(s) given are unsuitable
66             BadArraySize,      // Unsuitable array size (incompatible with other arguments)
67             BadCodomain,       // Supplied RingHom has wrong codomain
68             BadColIndex,       // Column index too large in a matrix
69             BadCompose,        // Attempt to compose maps with differing domain and codomain
70             BadComptIndex,     // Index too large accessing component of ModuleElem
71             BadConvert,        // Unable to convert value
72             BadDegIndex,       // Index too large accessing degree component
73             BadDomain,         // Supplied RingHom has wrong domain
74             BadGlobalSettings, // ambiguous, duplicate or incompatible global settings
75             BadIndetIndex,     // Indeterminate index too large in a polynomial ring
76             BadIndex,          // Index out of range
77             BadIndetNames,     // Duplicate indet names or varied number of indices for a single name
78             BadInducingHom,    // Inducing hom has wrong domain
79             BadInducingHom2,   // Inducing hom has wrong codomain
80             BadInducingHomKer, // Inducing hom has unsuitable kernel
81             BadMatrixSetEntry, // Attempt to set a matrix entry where this is forbidden
82             BadMatrixSize,     // Matrix of the wrong size for the requested operation
83             BadModulus,        // modulus must be at least 2 and fit into a long
84             BadNumBase,        // Base for number conversion must be between 2 and 36 (incl)
85             BadNumIndets,      // Wrong number of indet names when creating a PPMonoid or PolyRing
86             BadOpenMath,       // OpenMath input did not contain the expected tag
87             BadPPMonoid,       // PPMonoid supplied is not of the right type
88             BadPPMonoidHomArg, // Argument given to PPMonoidHom is not in the domain
89             BadProbability,    // Probability P must satisfy  0 <= P <= 1
90             BadPwrZero,        // Attempt to compute 0^N where N is not strictly positive
91             BadPolyRingHomImages,// Unsuitable indet images for creating PolyRing hom (wrong number or wrong ring)
92             BadQuot,           // Attempt to compute a quotient which does not exist in a given ring/monoid
93             BadQuotRing,       // Attempt to quotient by ideal(1)
94             BadRing,           // Used ring does not have required properties
95             BadRingHomArg,     // Argument given to a RingHom is in the wrong ring
96             BadPartialRingHomArg,// Partial RingHom is undefined for this argument
97             BadRowIndex,       // Row index too large in a matrix
98             BadSmallFpChar,    // Characteristic (for small finite field) too large or not prime
99             BadSymbolHead,     // Invalid symbolic name head (with illegal characters)
100             BadSymbolSubscript,    // Symbolic name: subscript too large or name does not have that many subscripts
101             BadSymbolRange,    // Incompatible names given to range
102             BLASFailed,        // A BLAS function failed
103             CannotReconstruct,
104             CanonicalHomFail,  // Unable to construct canonical homomorphism
105             ConstMatEntry,     // Cannot assign to constant matrix entry
106             DeadMemPool,       // Attempt to use a MemPool after it has been destroyed
107             DivByZero,         // Division by zero or a zero-divisor
108             Empty,             // Empty list or vector
109             ExpectedCoeffsInField, // Coefficient ring must be a field
110             EmbedBigRatFailed, // Cannot embed rational number into ring
111             ExpTooBig,         // Exponent is too large
112             GlobalManager1,    // No GlobalManager object has been created
113             GlobalManager2,    // May not create more than one GlobalManager object
114             IdealNotInRing,    // Incompatible ring and ideal
115             IncompatArgs,      // Args given are incompatible
116             IncompatDims,      // Incompatible dimenions
117             InputFail,         // An input operation failed
118             InsuffPrec,        // Insufficient precision when using RingTwinFloat values
119     ////???            IntDivByNeg,       // Integer division/remainder by negative divisor
120             InvertibleRingElem,// Non-invertible RingElem required
121             IterEnded,         // Attempt to advance an iter which has already reached the end
122             LapackFailed,      // A Lapack driver failed
123             LogZero,           // Cannot compute log of zero
124             MemPoolZero,       // Cannot use MemPool to manage blocks of zero size
125             MissNumLibs,       // Numerical libraries not configured in
126             MixedCoeffRings,   // Arithmetic operation between polys with different coeff rings
127             MixedDegrees,      // Arithmetic operation between incompatible degrees
128             MixedModules,      // Arithmetic operation between elements of different modules
129             MixedPolyIters,    // Comparison between iterators over different polys
130             MixedPPMs,         // Arithmetic operation between elements of different PPMonoids
131             MixedRings,        // Arithmetic operation between elements of different rings
132             MixedSizes,        // Operation between objects with different size
133             ModulusLT2,        // Modulus must be >= 2
134             NegExp,            // Negative exponent
135             NoGlobalMgr,       // GlobalManager must be created before using CoCoALib
136             NotCommutative,    // Ring must be commutative
137             NotDenseUPolyRing, // Ring must be a dense univariate polynomial ring, but is not
138             NotElemFrF,        // Operation makes sense only for elements of a fraction field
139             NotElemGCDDomain,  // Operation makes sense only for elements of a GCD domain
140             NotElemPolyRing,   // Operation makes sense only for elements of a polynomial ring
141             NotElemQuotientRing,// Operation makes sense only for elements of a quotient ring
142             NotElemSparsePolyRing,// Operation makes sense only for elements of a sparse polynomial ring
143             NotFGModule,       // Module must be Finitely Generated, but is not
144             NotField,          // Ring must be a field, but is not
145             NotFracField,      // Ring must be a FractionField, but is not
146             NotFreeModule,     // Module must be free, but is not
147             NotFullRank,       // Matrix must be full rank, but is not
148             NotModuleSpPR,     // Module must be on a SparsePolyRing, but is not
149             NotIndet,          // Expected an indeterminate
150             NotIntegralDomain, // Ring must be an integral domain, but is not
151             NotInvMatrix,      // Matrix is not invertible
152             NotMonomialGens,   // Ideal must be generated by monomials
153             NotNonNegative,    // Value must be non-negative
154             NotNonNegativeGrading,// Grading is not non-negative
155             NotNonZero,        // Value must be non-zero
156             NotOrdDom,         // Ring must be ordered, but is not
157             NotPolyRing,       // Ring must be a polynomial ring, but is not
158             NotPositive,       // Value is not positive
159             NotPositiveGrading,// Grading is not positive
160             NotQuotientRing,   // Ring must be a quotient ring, but is not
161             NotRingTwinFloat,  // Operation valid only over RingTwinFloat
162             NotSparsePolyRing, // Ring must be a sparse polynomial ring, but is not
163             NotSquareMatrix,   // Matrix must be square, but is not
164             NotTermOrdering,   // Ordering is not a term-ordering
165             NotTrueGCDDomain,  // Ring must be a true GCD domain (and not a field), but is not
166             NotUnit,           // Operation is valid only for invertible elements
167             NotUnivariate,     // Polynomial is not univariate
168             NullPtr,           // Null pointer passed where forbidden
169             NYI,               // NOT YET IMPLEMENTED
170             OBSOLESCENT,       // obsolescent fn called (to avoid this error give option AllowObsolescentFns to GlobalManager)
171             OutOfRange,        // Argument is out of range (too big or too small)
172             PolyIterEnded,     // Attempt to use an off-the-end iterator
173             PPOrder,           // PP is not in the right order
174             ShouldNeverGetHere, // Execution should never have reached here
175             TimedOut,           // Computation exceeded given time limit
176             ZeroModulus,       // Numerical operation specified a zero modulus
177             ZeroGradingDim,    // GradingDim (grading dimension) is 0
178             ZeroRingElem;      // Non-zero RingElem required
179   }
180 
181   /*-----------------------------------------------------------------*/
182   /** \include error.txt  */
183   /*-----------------------------------------------------------------*/
184   class ErrorInfo: public exception
185   {
186   public:
187     ErrorInfo(const std::string& mesg, const std::string& func);
188     ErrorInfo(const std::string& mesg, const std::string& func, const char* file, unsigned long line);
189     ErrorInfo(ERR::ID id, const std::string& func);
190     ErrorInfo(ERR::ID id, const std::string& func, const char* file, unsigned long line);
~ErrorInfo()191     ~ErrorInfo() /*noexcept*//*throw()*/ {}
192 ///???    const ERR::ID& id() const { return myID; }
193     bool operator==(const ERR::ID& id) const { return myID == id; }
194     bool operator!=(const ERR::ID& id) const { return myID != id; }
195     void myOutputSelf(std::ostream& out) const;
196   private: // Data members (incl. myMessage & myContext from CoCoA::exception)
197     friend void ANNOUNCE(std::ostream& out, const ErrorInfo& err);
198     const ERR::ID myID;
199     const std::string myFile;
200     const unsigned long myLine;
201   };
202 
203   std::ostream& operator<<(std::ostream& out, const ErrorInfo& err);
204   void ANNOUNCE(std::ostream& out, const ErrorInfo& err);
205 
206 
207 // Macro to avoid having to type explicitly __FILE__ and __LINE__
208 #define CoCoA_STATIC_ERROR_MESG(ErrName, ErrID, FnName)  static const ::CoCoA::ErrorInfo ErrName(ErrID, FnName, __FILE__, __LINE__)
209 
210 // Helpful Macro: create error obj and throw it (puts in file name and line num)
211 #define CoCoA_THROW_ERROR(ErrID, FnName)  ::CoCoA::ThrowException(::CoCoA::ErrorInfo(ErrID, FnName, __FILE__, __LINE__))
212 
213 // Macro below is obsolete: remove it by Dec 2022
214 #define CoCoA_ERROR  OBSOLETE___USE_CoCoA_THROW_ERROR
215 
216   namespace ErrorLanguage
217   {
218     void english(); // Set english as the language for error messages.
219     void italian(); // Set italian as the language for error messages.
220   }
221 
222 
223 
224 } // end of namespace CoCoA
225 
226 
227 
228 // RCS header/log in the next few lines.
229 // $Header: /Volumes/Home_1/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/error.H,v 1.62 2020/06/26 15:03:38 abbott Exp $
230 // $Log: error.H,v $
231 // Revision 1.62  2020/06/26 15:03:38  abbott
232 // Summary: Put CoCoA_ERROR macro back in, but it deliberately gives compile-time error (hopefully with helpful message)
233 //
234 // Revision 1.61  2020/06/22 15:39:57  abbott
235 // Summary: Added new macro CoCoA_STATIC_ERROR_MESG
236 //
237 // Revision 1.60  2020/06/19 19:42:59  abbott
238 // Summary: Cleaned; removed cruft
239 //
240 // Revision 1.59  2020/06/19 19:39:21  abbott
241 // Summary: Now all throws go through new template fn ThrowException; seems to work
242 //
243 // Revision 1.58  2020/06/19 14:51:45  abbott
244 // Summary: Eliminated macro CoCoA_THROW (caused trouble)
245 //
246 // Revision 1.57  2020/06/17 19:02:27  abbott
247 // Summary: Removed cruft; added comment
248 //
249 // Revision 1.56  2020/06/17 15:49:21  abbott
250 // Summary: Changed CoCoA_ERROR into CoCoA_THROW_ERROR
251 //
252 // Revision 1.55  2020/02/11 17:16:17  abbott
253 // Summary: All mem fns like myOutput now return void (redmine 969)
254 //
255 // Revision 1.54  2018/04/18 14:14:08  abbott
256 // Summary: Added new errors: IncompatArgs and NullPtr
257 //
258 // Revision 1.53  2018/03/20 11:38:52  bigatti
259 // -- added error "ExpectedCoeffsInField"
260 //
261 // Revision 1.52  2018/03/14 14:30:22  abbott
262 // Summary: Added new error OutOfRange
263 //
264 // Revision 1.51  2017/11/29 20:34:16  abbott
265 // Summary: Added SturmSeq and NumRealRoots
266 //
267 // Revision 1.50  2017/09/06 14:02:41  abbott
268 // Summary: Added new ERR::TimedOut; TimeoutException derives from ErrorInfo
269 //
270 // Revision 1.49  2017/09/06 11:56:28  abbott
271 // Summary: Changed ERR::SERIOUS into ERR::ShouldNeverGetHere
272 //
273 // Revision 1.48  2017/07/22 12:57:42  abbott
274 // Summary: Updated rtn type of myOutputSelf
275 //
276 // Revision 1.47  2017/05/11 08:46:46  bigatti
277 // -- added error ERR::CannotReconstruct
278 // -- cleaned up code accordingly
279 //
280 // Revision 1.46  2017/05/09 13:51:30  bigatti
281 // -- changed BadRingHomArg2 --> BadPartialRingHomArg
282 //
283 // Revision 1.45  2016/11/04 20:40:03  abbott
284 // Summary: Renamed ERR::OBSOLETE to ERR::OBSOLESCENT
285 //
286 // Revision 1.44  2016/11/03 12:29:58  abbott
287 // Summary: Added file for obsolescent fns; also there is a global flag saying whether to give error if calling one.
288 //
289 // Revision 1.43  2015/06/26 14:57:00  abbott
290 // Summary: Now ErrorInfo derives from CoCoA::exception
291 // Author: JAA
292 //
293 // Revision 1.42  2014/07/10 14:33:42  abbott
294 // Summary: Removed unused error code NotRingZ (or NotRingZZ, there was a typo!)
295 // Author: JAA
296 //
297 // Revision 1.41  2014/01/29 17:01:22  abbott
298 // Summary: Removed rather pointless "(no message)" default string for message associated to an error code
299 // Author: JAA
300 //
301 // Revision 1.40  2013/05/27 17:07:00  bigatti
302 // -- new name for error of FreeModule over SparsePolyRing
303 //
304 // Revision 1.39  2013/05/20 15:58:17  abbott
305 // Added new error code NotPositive.
306 //
307 // Revision 1.38  2013/02/21 16:56:49  bigatti
308 // -- added ERR:Empty
309 //
310 // Revision 1.37  2013/02/13 09:08:58  bigatti
311 // -- added ZeroGradingDim
312 //
313 // Revision 1.36  2013/01/21 13:37:29  abbott
314 // Added new error IncompatDims.
315 //
316 // Revision 1.35  2012/05/24 14:53:35  bigatti
317 // -- changed symbol "index" into "subscripts"
318 //
319 // Revision 1.34  2012/05/22 10:02:37  abbott
320 // Removed IsGCDDomain; substituted by IsTrueGCDDomain.
321 // Added IsFractionFieldOfGCDDomain.
322 //
323 // Revision 1.33  2012/03/26 11:51:35  abbott
324 // Rephrased error message associated with ERR::NotIndet.
325 //
326 // Revision 1.32  2012/03/16 15:51:35  abbott
327 // Added new error NotNonZero.
328 //
329 // Revision 1.31  2011/08/24 10:22:45  bigatti
330 // -- renamed QQ --> BigRat
331 //
332 // Revision 1.30  2011/06/23 16:02:26  abbott
333 // Minor changes to two error message strings.
334 //
335 // Revision 1.29  2011/05/03 09:54:44  abbott
336 // Changed macro arg name (to improve readability).
337 //
338 // Revision 1.28  2011/03/16 13:22:43  abbott
339 // Added new error "BadModulus".
340 //
341 // Revision 1.27  2011/01/19 16:13:06  bigatti
342 // -- added ERR::ModulusLT2
343 //
344 // Revision 1.26  2010/12/17 16:09:15  abbott
345 // Changed interface to ANNOUNCE function: now it requires the ostream to passed in.
346 // A few other minor changes.
347 //
348 // Revision 1.25  2010/10/22 14:03:04  abbott
349 // Major change to GMPAllocator -- it is now set/activated by the GlobalManager.
350 // This is a Friday afternoon check-in... hope to check in cleaner code in the
351 // next few days.
352 //
353 // Revision 1.24  2010/07/09 17:05:01  abbott
354 // Added new error for PPMonoid homs.
355 //
356 // Revision 1.23  2010/04/27 16:07:50  bigatti
357 // -- added 2 error messages for DynamicBitset
358 //
359 // Revision 1.22  2010/03/18 13:54:42  abbott
360 // Added new error for OpenMath input problems.
361 //
362 // Revision 1.21  2010/02/03 12:02:44  bigatti
363 // -- added NotMonomialGens
364 //
365 // Revision 1.20  2009/12/23 18:53:52  abbott
366 // Major change to conversion functions:
367 //   convert(..) is now a procedure instead of a function
368 //   IsConvertible(..) replaces the former convert(..) function
369 //   Added new NumericCast conversion function (placeholder for BOOST feature)
370 //   Consequent changes in code which uses these features.
371 //
372 // Revision 1.19  2009/12/11 11:46:32  abbott
373 // Changed fn  convert  into  IsConvertible.
374 // Added template procedure  convert.
375 // New version because change is not backward compatible.
376 //
377 // Revision 1.18  2009/12/03 17:26:35  abbott
378 // Renamed EFGModule to FGModule.
379 // Renamed ModuleBase member fns  myInit -> myNew, myKill -> myDelete.
380 // Removed some cruft (old code that was not used by anyone).
381 //
382 // Revision 1.17  2009/10/29 18:47:58  abbott
383 // Added IterEnded error code.
384 //
385 // Revision 1.16  2009/07/02 16:32:11  abbott
386 // Consequential changes stemming from new class QQ, and modified interface to the member
387 // function RingBase::myIsRational.  Also some new conversion functions.
388 //
389 // Revision 1.15  2009/05/20 14:25:30  abbott
390 // Added new error for InputFailCheck.
391 //
392 // Revision 1.14  2008/12/16 21:11:43  abbott
393 // Improved error message for bad symbol index -- there are two possible causes.
394 //
395 // Revision 1.13  2008/10/08 13:54:05  abbott
396 // New minor version to reflect the backward-incompatible changes to CoCoA errors.
397 //
398 // Revision 1.12  2008/10/08 09:48:19  abbott
399 // Final(?) minor refinement to CoCoA::ERR:ID internal layout.
400 //
401 // Revision 1.11  2008/10/07 15:45:22  abbott
402 // Changed ErrorInfo objects so they include the name of their own error ID.
403 // Changed catch statements to catch const objects.
404 // Removed calls to the member fn which accessed the error ID member of an
405 // ErrorInfo; now you simply compare directly with the error ID (makes the
406 // code easier to read).
407 //
408 // Revision 1.10  2008/06/30 17:21:08  abbott
409 // Added ugly workaround for Solaris ERR bug.
410 //
411 // Revision 1.9  2008/04/21 12:51:53  abbott
412 // Added some new error codes.
413 //
414 // Revision 1.8  2008/03/12 16:35:18  bigatti
415 // -- changed: IsHomogeneous --> IsHomog
416 // -- changed: ERR:ZeroPoly --> ERR::ZeroRingElem
417 //
418 // Revision 1.7  2007/10/30 17:14:11  abbott
419 // Changed licence from GPL-2 only to GPL-3 or later.
420 // New version for such an important change.
421 //
422 // Revision 1.6  2007/10/05 14:35:16  bigatti
423 // -- added error: NotDenseUPolyRing
424 //
425 // Revision 1.5  2007/09/24 14:18:07  abbott
426 // Changed layout of comments.
427 //
428 // Revision 1.4  2007/06/21 21:29:47  abbott
429 // Changed name of RingFloat into RingTwinFloat.
430 //
431 // Revision 1.3  2007/05/21 12:57:28  abbott
432 // New class for passing machine integers as args; includes some simple
433 // operations on machine integers (cmp, gcd, IsNegative,...).  Operations
434 // between ZZ and machine integers modified to use the new class.  Inexact
435 // integer division (of a ZZ) by a negative value now triggers an error;
436 // new error for reporting inexact integer division by a negative value.
437 //
438 // Revision 1.2  2007/03/28 10:06:13  abbott
439 // Now gives error when you use RingZ() or RingQ() without creating GlobalManager.
440 //
441 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
442 // Imported files
443 //
444 // Revision 1.13  2007/03/08 11:07:12  cocoa
445 // Made pseudo ctors for polynomial rings more uniform.  This allowed me to
446 // remove an include of CoCoA/symbol.H  from the RingDistrM*.H files, but then
447 // I had to put the include in several .C files.
448 //
449 // Revision 1.12  2007/03/05 21:34:36  cocoa
450 // Ooops, forgot to check these in a few mins ago.  Revised names for hom pseudo-ctors; new error
451 // for CanonicalHom.
452 //
453 // Revision 1.11  2007/03/05 16:17:11  bigatti
454 // -- clenup for numerical code (and 3 new error codes)
455 //
456 // Revision 1.10  2007/03/03 14:07:23  bigatti
457 // -- "foundations" renamed into "GlobalManager"
458 //
459 // Revision 1.9  2007/03/02 10:47:53  cocoa
460 // First stage of RingZ modifications -- tests do not compile currently, Anna will fix this.
461 //
462 // Revision 1.8  2007/02/12 17:40:19  bigatti
463 // -- added MissNumLibs
464 //
465 // Revision 1.7  2007/01/13 14:14:34  cocoa
466 // Overhaul of RingHom code: it nows uses SmartPtrIRC, and printing is more logical.
467 // Have not yet updated the documentation.
468 //
469 // Revision 1.6  2006/12/21 13:46:54  cocoa
470 // Improved layout; added one new error code.
471 //
472 // Revision 1.5  2006/12/06 17:17:44  cocoa
473 // -- removed #include "config.H"
474 //
475 // Revision 1.4  2006/10/06 10:10:15  cocoa
476 // Corrected a comment.  Corrected position of #ifndef etc.
477 //
478 // Revision 1.3  2006/08/07 21:23:25  cocoa
479 // Removed almost all publicly visible references to SmallExponent_t;
480 // changed to long in all PPMonoid functions and SparsePolyRing functions.
481 // DivMask remains to sorted out.
482 //
483 // Revision 1.2  2006/07/17 19:16:53  cocoa
484 // New, better errors :-)
485 //
486 // Revision 1.1.1.1  2006/05/30 11:39:36  cocoa
487 // Imported files
488 //
489 // Revision 1.6  2006/04/14 13:51:40  cocoa
490 // Added a class for generating random bits (RandomBitStream in the file random.H).
491 //
492 // Revision 1.5  2006/04/07 16:44:52  cocoa
493 // Considerably updated MemPool design -- it works, and I'm about to test
494 // its efficiency against the old one.
495 //
496 // Revision 1.4  2006/04/04 13:01:02  cocoa
497 // -- added: NotNonNegativeGrading, NotPositiveGrading
498 //
499 // Revision 1.3  2006/03/27 12:21:26  cocoa
500 // Minor silly changes to reduce number of complaints from some compiler or other.
501 //
502 // Revision 1.2  2005/11/24 16:09:38  cocoa
503 // -- added operator[] for ModuleElem
504 //
505 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
506 // Imported files
507 //
508 // Revision 1.8  2005/09/28 11:50:35  cocoa
509 // -- new code for graded modules
510 //
511 // Revision 1.7  2005/08/08 16:36:32  cocoa
512 // Just checking in before going on holiday.
513 // Don't really recall what changes have been made.
514 // Added IsIndet function for RingElem, PPMonoidElem,
515 // and a member function of OrdvArith.
516 // Improved the way failed assertions are handled.
517 //
518 // Revision 1.6  2005/07/19 15:30:20  cocoa
519 // A first attempt at iterators over sparse polynomials.
520 // Main additions are to SparsePolyRing, DistrMPoly*.
521 // Some consequential changes to PPMonoid*.
522 //
523 // Revision 1.5  2005/07/15 16:34:33  cocoa
524 // Added iterators for sparse polynomials.
525 // The code compiles (and the old tests still run).
526 // It'd Friday evening -- I'm going home before
527 // getting any ideas about making the iterator code run.
528 //
529 // Revision 1.4  2005/07/08 15:09:29  cocoa
530 // Added new symbol class (to represent names of indets).
531 // Integrated the new class into concrete polynomial rings
532 // and PPMonoid -- many consequential changes.
533 // Change ctors for the "inline" sparse poly rings: they no
534 // longer expect a PPMonoid, but build their own instead
535 // (has to be a PPMonoidOv).
536 //
537 // Revision 1.3  2005/07/01 16:08:16  cocoa
538 // Friday check-in.  Major change to structure under PolyRing:
539 // now SparsePolyRing and DUPolyRing are separated (in preparation
540 // for implementing iterators).
541 //
542 // A number of other relatively minor changes had to be chased through
543 // (e.g. IndetPower).
544 //
545 // Revision 1.2  2005/06/27 14:55:24  cocoa
546 // Cleaned up some more PPMonoid code.
547 //
548 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
549 // Imported files
550 //
551 // Revision 1.8  2005/04/29 15:42:02  cocoa
552 // Improved documentation for GMPAllocator.
553 // Added example program for GMPAllocator.
554 // Added example program for simple ops on polynomials.
555 // Added two new ctors for (principal) ideals (from long, and from ZZ).
556 // Added (crude) printing for PPMonoids.
557 // Updated library.H (#included GMPAllocator.H).
558 //
559 // Revision 1.7  2005/04/27 16:14:56  cocoa
560 // Cleaned up example programs -- added "free use" permit.
561 // Changed a couple of ErrorInfo object names, and added
562 // ERR::NotTrueGCDDomain.
563 //
564 // Revision 1.6  2005/04/20 15:40:48  cocoa
565 // Major change: modified the standard way errors are to be signalled
566 // (now via a macro which records filename and line number).  Updated
567 // documentation in error.txt accordingly.
568 //
569 // Improved the documentation in matrix.txt (still more work to be done).
570 //
571 // Revision 1.5  2005/04/19 14:06:04  cocoa
572 // Added GPL and GFDL licence stuff.
573 //
574 // Revision 1.4  2005/03/11 16:44:18  cocoa
575 // New abstract class structure for matrices.
576 // New types of special matrix.
577 //
578 // Revision 1.3  2005/03/02 18:46:41  cocoa
579 // Added new types ConstRefMatrix, and RefMatrix following along
580 // the lines of ConstRefRingElem and RefRingElem.  The semantics
581 // should be a bit clearer now.
582 //
583 // Revision 1.2  2005/02/22 12:50:40  cocoa
584 // -- added: NotFullRank, NotIntDom, NotTermOrdering
585 //
586 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
587 // Imported files
588 //
589 // Revision 1.19  2004/11/25 16:14:21  cocoa
590 // (1) Fixed definition of specialization of std::swap template function
591 //     so that it compiles with gcc 3.4.3
592 // (2) Implemented monomial function for polynomial rings.
593 // (3) Added one(PPM) and PPM->myOne() functions.
594 //
595 // Revision 1.18  2004/11/19 17:43:50  cocoa
596 // -- added matrix related errors
597 //
598 // Revision 1.17  2004/11/19 16:15:51  cocoa
599 // (a) Removed unused error message about degree of zero;
600 //     replaced it by a more general message about needing a
601 //     non-zero polynomial (for various ops such as LC, LPP).
602 // (b) Added some missing arg checking in LC, LPP and deg
603 //     (for elems of a PolyRing).
604 // (c) Updated some commented out code in GPair and GPoly.
605 //
606 // Revision 1.16  2004/11/19 15:14:09  cocoa
607 // (a) Added new check to MemPool so that it can signal an
608 //     error if one tries to use a MemPool after it has been
609 //     destroyed.
610 // (b) Improved makefile in TEST/ so that it checks output,
611 //     and prints useful messages if the test fails.
612 // (c) Tidied ring.txt a bit (still more to do).
613 //
614 // Revision 1.15  2004/11/12 15:49:29  cocoa
615 // Tidying prior to 0.90 release.
616 // (a) documentation improved (or marked as poor)
617 // (b) sundry minor improvements to the code
618 //
619 // Revision 1.14  2004/11/11 14:16:37  cocoa
620 // -- added \include *.txt for doxygen
621 //
622 // Revision 1.13  2004/11/11 11:56:09  cocoa
623 // (1) Tidied makefiles, and introduced common.mki
624 // (2) Improved several tests, and cleaned them so that they
625 //     handle sanely any otherwise unhandled exceptions.
626 //
627 // Revision 1.12  2004/11/09 15:53:56  cocoa
628 // -- added BadQuotRing("Attempt to quotient by ideal(1)")
629 //
630 // Revision 1.11  2004/11/05 15:37:56  cocoa
631 // Added a couple of new errors.
632 //
633 // Revision 1.10  2004/11/03 18:01:55  cocoa
634 // -- clarified behaviour of error()
635 // -- added ANNOUNCE function
636 // -- minor tidying
637 //
638 // Revision 1.8  2004/07/27 16:03:38  cocoa
639 // Added IsCommutative test and IamCommutative member function
640 // to all rings.  Tidied geobuckets a little.
641 //
642 // Revision 1.7  2004/07/20 15:04:06  cocoa
643 // The next step in the new "ring element" conversion process:
644 // handling the case of creating a "const RefRingElem" object
645 // (since C++ refuses to do this properly itself).
646 //
647 // Revision 1.6  2004/07/14 16:40:42  cocoa
648 // Separated RingFpLog from its implementation which now resides in
649 // a new class: SmallFpLogImpl.  This is analogous to the change made
650 // to RingFp yesterday.
651 //
652 // Some tidying and other sundry minor changes.
653 //
654 // Revision 1.5  2004/07/13 16:32:26  cocoa
655 // First stage of major revamp of ring elements.
656 // Implementation of RingFp has been split into "ring interface"
657 // and "algorithms plus data structures".
658 //
659 // Revision 1.4  2004/06/29 17:10:22  cocoa
660 // Partially tidied use of "protected" and "private" in various
661 // base classes.  Checking in at the end of the day -- it works,
662 // and I wouldn't want it to be lost next time point's disk
663 // misbehaves.
664 //
665 // Revision 1.3  2004/05/27 16:14:02  cocoa
666 // Minor revision for new coding conventions.
667 //
668 // Revision 1.2  2004/05/24 15:52:13  cocoa
669 // Major update:
670 //   new error mechanism
671 //   many fixes
672 //   RingHoms almost work now
673 //   RingFloat much improved
674 //
675 // Revision 1.1.1.1  2003/09/24 12:55:43  cocoa
676 // Imported files
677 //
678 // Revision 1.5  2003/06/23 16:15:05  abbott
679 // Minor cleaning prior to public release.
680 //
681 // Revision 1.4  2002/11/13 15:37:49  abbott
682 // Added a second field to CoCoAError to allow the location of an
683 // error to be indicated.  Also a new accessor function "where" to
684 // read the new field, and a query function saying whether the new
685 // field has a non-trivial value (HasLocation).  The old constructor
686 // remains, and is joined by a new one allowing the location field
687 // to be specified.
688 //
689 // Revision 1.3  2002/01/25 15:16:59  abbott
690 // Added class CoCoAError as a temporary solution; the standard library
691 // exception classes do not seem to offer what we need.
692 //
693 // Revision 1.2  2001/12/07 15:56:48  abbott
694 // error function now takes an exception as an argument, instead of a string.
695 //
696 // Revision 1.1  2001/11/26 19:13:24  abbott
697 // Initial revision
698 //
699 
700 #endif
701