CoCoALib-0.9905 date: 23 May 2007


RingFloat.H

Go to the documentation of this file.
00001 #ifndef CoCoA_RingFloat_H
00002 #define CoCoA_RingFloat_H
00003 
00004 //   Copyright (c)  2005  John Abbott
00005 
00006 //   This file is part of the source of CoCoALib, the CoCoA Library.
00007 
00008 //   CoCoALib is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License (version 2)
00010 //   as published by the Free Software Foundation.  A copy of the full
00011 //   licence may be found in the file COPYING in this directory.
00012 
00013 //   CoCoALib is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //   GNU General Public License for more details.
00017 
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with CoCoA; if not, write to the Free Software
00020 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 
00023 // Header file for the classes RingFloat and RingFloatImpl
00024 
00025 
00026 #include "CoCoA/ring.H"
00027 #include "CoCoA/error.H"
00028 
00029 
00030 namespace CoCoA
00031 {
00032 
00033   class RingFloatBase: public RingBase
00034   {
00035   public: // member functions specific to RingFloat implementations
00036     virtual size_t myPrecisionBits() const = 0;
00037   };
00038 
00039 
00040   class RingFloat: public ring
00041   {
00042   public:
00043     explicit RingFloat(const RingFloatBase* RingPtr);
00044     // Default copy ctor works fine.
00045     // Default dtor works fine.
00046   private:
00047     RingFloat& operator=(const RingFloat& rhs); ///< NEVER DEFINED -- disable assignment
00048   public:
00049     const RingFloatBase* operator->() const; // allow member fns to be called
00050 
00051   public:
00052     // Exception class to indicate when the error growth impedes further computation
00053     class InsufficientPrecision: public ErrorInfo
00054     {
00055     public:
00056       InsufficientPrecision();
00057     };
00058   };
00059 
00060 
00061   RingFloat NewRingFloat(size_t MantissaBits);
00062   bool IsRingFloat(const ring& RR);
00063   RingFloat AsRingFloat(const ring& RR);
00064   size_t PrecisionBits(const RingFloat& RR);
00065   bool IsPracticallyEqual(ConstRefRingElem x, ConstRefRingElem y); // applicable only if x & y are elems of a RingFloat
00066 
00067   //---------------------------------------------------------------------------
00068   // Inline functions
00069 
00070   inline const RingFloatBase* RingFloat::operator->() const
00071   {
00072     return static_cast<const RingFloatBase*>(ring::operator->());
00073   }
00074 
00075 
00076 } // end of namespace CoCoA
00077 
00078 
00079 
00080 // RCS header/log in the next few lines
00081 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/RingFloat.H,v 1.2 2007/03/21 14:52:49 bigatti Exp $
00082 // $Log: RingFloat.H,v $
00083 // Revision 1.2  2007/03/21 14:52:49  bigatti
00084 // -- added AsRingFloat(R)
00085 //
00086 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00087 // Imported files
00088 //
00089 // Revision 1.7  2006/12/06 17:21:56  cocoa
00090 // -- removed #include "config.H"
00091 //
00092 // Revision 1.6  2006/11/20 15:55:03  cocoa
00093 // ring is now a class again.  Improved definitions of operator-> in derived classes.
00094 //
00095 // Revision 1.5  2006/11/03 14:01:46  cocoa
00096 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
00097 //    uses SmartPtrIRC
00098 //
00099 // Revision 1.4  2006/10/16 23:18:59  cocoa
00100 // Corrected use of std::swap and various special swap functions.
00101 // Improved myApply memfn for homs of RingDistrMPolyInlPP.
00102 //
00103 // Revision 1.3  2006/10/06 10:12:07  cocoa
00104 // Corrected position of #include.  Fixed incorrect #include.
00105 //
00106 // Revision 1.2  2006/07/17 19:14:53  cocoa
00107 // First stage of big change.
00108 //
00109 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00110 // Imported files
00111 //
00112 // Revision 1.6  2006/05/29 16:22:37  cocoa
00113 // Third time lucky???
00114 // Added myIsInteger member function to all rings (NYI for RingFloat).
00115 //
00116 // Revision 1.5  2006/05/12 16:10:58  cocoa
00117 // Added OpenMathFwd.H, and tidied OpenMath.H.
00118 // Many consequential but trivial changes.
00119 //
00120 // Revision 1.4  2006/03/15 18:09:31  cocoa
00121 // Changed names of member functions which print out their object
00122 // into myOutputSelf -- hope this will appease the Intel C++ compiler.
00123 //
00124 // Revision 1.3  2006/03/14 15:01:49  cocoa
00125 // Improved the implementation of ring member fns for computing powers.
00126 // Should keep Intel C++ compiler quieter too.
00127 //
00128 // Revision 1.2  2006/03/12 21:28:34  cocoa
00129 // Major check in after many changes
00130 //
00131 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00132 // Imported files
00133 //
00134 // Revision 1.2  2005/06/22 14:42:16  cocoa
00135 // Renamed MemPool data member to myMemMgr
00136 // (seems more sensible than myMemory).
00137 //
00138 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00139 // Imported files
00140 //
00141 // Revision 1.4  2005/04/20 15:40:48  cocoa
00142 // Major change: modified the standard way errors are to be signalled
00143 // (now via a macro which records filename and line number).  Updated
00144 // documentation in error.txt accordingly.
00145 //
00146 // Improved the documentation in matrix.txt (still more work to be done).
00147 //
00148 // Revision 1.3  2005/04/19 14:06:04  cocoa
00149 // Added GPL and GFDL licence stuff.
00150 //
00151 // Revision 1.2  2005/02/11 14:15:20  cocoa
00152 // New style ring elements and references to ring elements;
00153 // I hope I have finally got it right!
00154 //
00155 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00156 // Imported files
00157 //
00158 // Revision 1.11  2004/11/18 18:33:41  cocoa
00159 // Now every ring know its own "one" element (as well as "zero").
00160 // Several consequential changes.
00161 //
00162 // Revision 1.10  2004/11/11 13:04:30  cocoa
00163 // -- added \include *.txt for doxygen
00164 //
00165 // Revision 1.9  2004/11/05 15:34:33  cocoa
00166 // Consequential change following from the renaming of
00167 // FieldIdealImpl and the introduction of the new pseudo-ctor.
00168 //
00169 // Revision 1.8  2004/11/04 18:47:43  cocoa
00170 // (1) Ring member functions which previously expected mpz_t args
00171 //     now expect ZZ args.  Numerous minor consequential changes.
00172 // (2) Renamed function which gives access to the mpz_t value inside
00173 //     a ZZ object: previously was raw(...), now is mpzref(...).
00174 //     Plenty of calls had to be altered.
00175 //
00176 // Revision 1.7  2004/07/27 16:03:39  cocoa
00177 // Added IsCommutative test and IamCommutative member function
00178 // to all rings.  Tidied geobuckets a little.
00179 //
00180 // Revision 1.6  2004/07/16 15:45:12  cocoa
00181 // First stage of new RingElem implementation completed.
00182 //
00183 // Revision 1.5  2004/05/24 15:52:13  cocoa
00184 // Major update:
00185 //   new error mechanism
00186 //   many fixes
00187 //   RingHoms almost work now
00188 //   RingFloat much improved
00189 //
00190 // Revision 1.4  2004/04/08 15:33:34  cocoa
00191 // Added function IsInteger, and the related RingBase::myIsInteger
00192 // virtual function, plus all necessary implementations.
00193 //
00194 // Revision 1.3  2004/03/20 17:46:10  cocoa
00195 // Check in prior to departure to RWCA
00196 //
00197 // Revision 1.2  2004/02/03 16:16:20  cocoa
00198 // Removed pointless IamGCDDomain functions from several concrete rings.
00199 // Added IamOrderedDomain functions where appropriate.
00200 // Tidied ctors for the small finite fields.
00201 //
00202 // Revision 1.1  2004/01/28 15:54:09  cocoa
00203 // Sundry additions.
00204 //
00205 
00206 #endif

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