CoCoALib-0.9905 date: 23 May 2007


FractionField.H

Go to the documentation of this file.
00001 #ifndef CoCoA_FractionField_H
00002 #define CoCoA_FractionField_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 abstract class FractionField
00024 
00025 
00026 #include "CoCoA/ring.H"
00027 
00028 
00029 namespace CoCoA
00030 {
00031 
00032   class FractionFieldBase: public RingBase
00033   {
00034   public:
00035     // functions special to a FractionField
00036     virtual const ring& myBaseRing() const = 0;
00037     virtual void myGetNum(RawPtr rawn, ConstRawPtr rawq) const = 0; ///< n is elem of BaseRing!!
00038     virtual void myGetDen(RawPtr rawd, ConstRawPtr rawq) const = 0; ///< d is elem of BaseRing!!
00039     virtual const RingHom& myEmbeddingHom() const = 0;
00040     virtual RingHom myInducedHomCtor(const RingHom& phi) const = 0;
00041   };
00042 
00043 
00044   /*-----------------------------------------------------------------*/
00045   /** \include FractionField.txt  */
00046   /*-----------------------------------------------------------------*/
00047 
00048   class FractionField: public ring
00049   {
00050   public:
00051     explicit FractionField(const FractionFieldBase* RingPtr);
00052     // Default copy ctor works fine.
00053     // Default dtor works fine.
00054   private:
00055     FractionField& operator=(const FractionField& rhs); ///< NEVER DEFINED -- disable assignment
00056   public:
00057     const FractionFieldBase* operator->() const; ///< allow const member fns to be called
00058   };
00059 
00060 
00061   // Pseudo-ctor and functions on FractionFields.
00062   FractionField NewFractionField(const ring& R);
00063   bool IsFractionField(const ring& Q);
00064   FractionField AsFractionField(const ring& R);
00065   const ring& BaseRing(const FractionField& Q);
00066   const RingHom& EmbeddingHom(const FractionField& FrF);
00067   RingHom InducedHom(const FractionField& FrF, const RingHom& InducingHom);
00068 
00069   // Functions on RingElems applicable only to elems of a FractionField.
00070   RingElem num(ConstRefRingElem q);
00071   RingElem den(ConstRefRingElem q);
00072 
00073 
00074 
00075   /////////////////////////////////////////////////////////////////////////////
00076   // Inline function
00077 
00078 
00079   inline const FractionFieldBase* FractionField::operator->() const
00080   {
00081     return static_cast<const FractionFieldBase*>(ring::operator->());
00082   }
00083 
00084 
00085 } // end of namespace CoCoA
00086 
00087 
00088 // RCS header/log in the next few lines
00089 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/FractionField.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00090 // $Log: FractionField.H,v $
00091 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00092 // Imported files
00093 //
00094 // Revision 1.8  2007/03/05 21:06:07  cocoa
00095 // New names for homomorphism pseudo-ctors: removed the "New" prefix.
00096 //
00097 // Revision 1.7  2007/01/11 14:06:15  cocoa
00098 // -- added prefix "raw" to RawPtr arguments names
00099 //
00100 // Revision 1.6  2006/12/06 17:11:16  cocoa
00101 // -- removed #include "config.H"
00102 //
00103 // Revision 1.5  2006/11/20 15:55:03  cocoa
00104 // ring is now a class again.  Improved definitions of operator-> in derived classes.
00105 //
00106 // Revision 1.4  2006/11/08 16:21:59  cocoa
00107 // Structural cleaning of RingHom; many consequential changes.
00108 //
00109 // Revision 1.3  2006/11/03 14:01:46  cocoa
00110 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
00111 //    uses SmartPtrIRC
00112 //
00113 // Revision 1.2  2006/10/06 10:15:53  cocoa
00114 // In response to Susan's bug: a fiasco when compiling with CoCoA_MEMPOOL_DEBUG
00115 // set wrongly.  Moved several implementation classes out of their header files
00116 // into the implementation files.  Several functions had to be uninlined.
00117 // Also corrected position of #include, etc.
00118 //
00119 // Revision 1.1.1.1  2006/05/30 11:39:36  cocoa
00120 // Imported files
00121 //
00122 // Revision 1.3  2006/05/12 16:10:59  cocoa
00123 // Added OpenMathFwd.H, and tidied OpenMath.H.
00124 // Many consequential but trivial changes.
00125 //
00126 // Revision 1.2  2006/03/12 21:28:34  cocoa
00127 // Major check in after many changes
00128 //
00129 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00130 // Imported files
00131 //
00132 // Revision 1.3  2005/07/08 15:09:29  cocoa
00133 // Added new symbol class (to represent names of indets).
00134 // Integrated the new class into concrete polynomial rings
00135 // and PPMonoid -- many consequential changes.
00136 // Change ctors for the "inline" sparse poly rings: they no
00137 // longer expect a PPMonoid, but build their own instead
00138 // (has to be a PPMonoidOv).
00139 //
00140 // Revision 1.2  2005/06/22 14:42:16  cocoa
00141 // Renamed MemPool data member to myMemMgr
00142 // (seems more sensible than myMemory).
00143 //
00144 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00145 // Imported files
00146 //
00147 // Revision 1.4  2005/04/20 15:40:48  cocoa
00148 // Major change: modified the standard way errors are to be signalled
00149 // (now via a macro which records filename and line number).  Updated
00150 // documentation in error.txt accordingly.
00151 //
00152 // Improved the documentation in matrix.txt (still more work to be done).
00153 //
00154 // Revision 1.3  2005/04/19 14:06:04  cocoa
00155 // Added GPL and GFDL licence stuff.
00156 //
00157 // Revision 1.2  2005/02/11 14:15:20  cocoa
00158 // New style ring elements and references to ring elements;
00159 // I hope I have finally got it right!
00160 //
00161 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00162 // Imported files
00163 //
00164 // Revision 1.16  2004/11/19 15:44:27  cocoa
00165 // Changed names of "casting" functions which convert a ring into
00166 // one with a more special structure (e.g. FractionField).  These
00167 // functions now have names starting with "As".  There were several
00168 // consequential changes.
00169 //
00170 // Revision 1.15  2004/11/18 18:33:41  cocoa
00171 // Now every ring know its own "one" element (as well as "zero").
00172 // Several consequential changes.
00173 //
00174 // Revision 1.14  2004/11/08 14:03:32  cocoa
00175 // -- small changes for doxygen support
00176 //
00177 // Revision 1.13  2004/11/05 15:34:33  cocoa
00178 // Consequential change following from the renaming of
00179 // FieldIdealImpl and the introduction of the new pseudo-ctor.
00180 //
00181 // Revision 1.12  2004/11/04 18:47:43  cocoa
00182 // (1) Ring member functions which previously expected mpz_t args
00183 //     now expect ZZ args.  Numerous minor consequential changes.
00184 // (2) Renamed function which gives access to the mpz_t value inside
00185 //     a ZZ object: previously was raw(...), now is mpzref(...).
00186 //     Plenty of calls had to be altered.
00187 //
00188 // Revision 1.11  2004/07/27 16:03:39  cocoa
00189 // Added IsCommutative test and IamCommutative member function
00190 // to all rings.  Tidied geobuckets a little.
00191 //
00192 // Revision 1.10  2004/07/16 15:45:12  cocoa
00193 // First stage of new RingElem implementation completed.
00194 //
00195 // Revision 1.9  2004/05/24 15:52:14  cocoa
00196 // Major update:
00197 //   new error mechanism
00198 //   many fixes
00199 //   RingHoms almost work now
00200 //   RingFloat much improved
00201 //
00202 // Revision 1.8  2004/04/08 15:33:34  cocoa
00203 // Added function IsInteger, and the related RingBase::myIsInteger
00204 // virtual function, plus all necessary implementations.
00205 //
00206 // Revision 1.7  2004/03/20 17:46:10  cocoa
00207 // Check in prior to departure to RWCA
00208 //
00209 // Revision 1.6  2004/02/03 16:16:21  cocoa
00210 // Removed pointless IamGCDDomain functions from several concrete rings.
00211 // Added IamOrderedDomain functions where appropriate.
00212 // Tidied ctors for the small finite fields.
00213 //
00214 // Revision 1.5  2004/01/30 14:07:10  cocoa
00215 // Tidied RingRawValue union: now it contains just two fields,
00216 // and has no need of forward declarations of types used internally
00217 // by the concrete rings -- it uses explicitly a void* instead.
00218 //
00219 // I have tidied the "import" functions used by most concrete rings.
00220 //
00221 // I have moved the choice of representation type for RingFp and RingFpLog
00222 // into a typedef in config.H -- this is to recognise that different
00223 // choices may work best on different platforms.
00224 //
00225 // Revision 1.4  2003/11/14 13:06:05  cocoa
00226 // -- New function "myIsPrintAtom" for printing polynomials and fractions
00227 //
00228 // Revision 1.3  2003/10/17 10:51:06  cocoa
00229 // Major cleaning, and new naming convention.
00230 //
00231 // Revision 1.2  2003/10/09 12:16:38  cocoa
00232 // New coding convention for rings.
00233 //
00234 // Revision 1.6  2003/06/23 16:45:30  abbott
00235 // Prior to public release:
00236 //   cleaned up num/den member functions
00237 //   revised GeneralFractionField following the new RingBase class
00238 //
00239 // Revision 1.5  2003/05/27 15:53:27  abbott
00240 // Changed name from FractionField to GeneralFractionField.
00241 // Added EmbeddingHom and EmbeddingHom_t (to map from R into FrF(R)).
00242 //
00243 // Revision 1.4  2003/05/15 10:15:58  abbott
00244 // Consequential changes from ring.H: old changes to names and some
00245 // member functions.  Added homomorphisms and ideals (reqd by ring.H).
00246 //
00247 // Revision 1.3  2002/11/15 10:41:25  abbott
00248 // Revised according the renaming in ring.H.
00249 // A small amount of tidying up too.
00250 //
00251 // Revision 1.2  2002/07/05 15:31:13  abbott
00252 // Added member function IsDivisible.
00253 // Zero element of ring is now in an auto_ptr (possibly gives better exception safety).
00254 //
00255 // Revision 1.1  2002/06/22 16:47:02  abbott
00256 // Initial revision
00257 //
00258 //
00259 
00260 #endif

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