CoCoALib-0.9905 date: 23 May 2007


QuotientRing.H

Go to the documentation of this file.
00001 #ifndef CoCoA_QuotientRing_H
00002 #define CoCoA_QuotientRing_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 QuotientRingBase
00024 // and associated class QuotientRing
00025 
00026 
00027 #include "CoCoA/error.H"
00028 #include "CoCoA/ideal.H"
00029 #include "CoCoA/ring.H"
00030 #include "CoCoA/RingHom.H"
00031 
00032 #include <vector>
00033 //using std::vector;
00034 #include <iosfwd>
00035 //using std::ostream;
00036 
00037 namespace CoCoA
00038 {
00039 
00040   class OpenMathOutput; // forward declaration -- defined in OpenMath.H
00041   class RingZ;          // forward declaration -- defined in RingZ.H
00042 
00043   /*-----------------------------------------------------------------*/
00044   /** \include QuotientRing.txt  */
00045   /*-----------------------------------------------------------------*/
00046   class QuotientRing; // fwd declaration needed for friend declarations
00047 
00048   class QuotientRingBase: public RingBase
00049   {
00050   protected:
00051     QuotientRingBase(const ring& R, const ideal& I);
00052 
00053   public:
00054     // functions special to a QuotientRing
00055     virtual RingElem myCanonicalRepr(ConstRawPtr rawx) const = 0; // result is element of myReprRing
00056     virtual void myReduction(RawPtr rawimage, ConstRawPtr rawarg) const = 0;
00057     virtual const RingHom& myQuotientingHom() const = 0;
00058     virtual RingHom myInducedHomCtor(const RingHom& InducingHom) const = 0;
00059   protected: // data members common to all implementations of quotient rings
00060     ring myBaseRing;
00061     const ideal myDefiningIdeal;
00062     const ring myReprRing;
00063     const ideal myReducingIdeal;
00064     friend const ring& BaseRing(const QuotientRing& RmodI);
00065     friend const ideal& DefiningIdeal(const QuotientRing& RmodI);
00066     friend const ring& ReprRing(const QuotientRing& RmodI);
00067     friend const ideal& ReducingIdeal(const QuotientRing& RmodI);
00068   protected:
00069     RingHom myQuotientingHomCtor() const; // pseudo-ctor for the quotienting hom.
00070   };
00071 
00072 
00073   class QuotientRing: public ring
00074   {
00075   public:
00076     explicit QuotientRing(const QuotientRingBase* RingPtr);
00077     // Default copy ctor works fine.
00078     // Default dtor works fine.
00079   private: // disable assignment
00080     QuotientRing& operator=(const QuotientRing& rhs); ///< NEVER DEFINED -- assignment disabled
00081   public:
00082     const QuotientRingBase* operator->() const; ///< covariant return type -- allow member fns to be called
00083   };
00084 
00085 
00086   QuotientRing NewQuotientRing(const ring& R, const ideal& I);
00087   QuotientRing NewZmod(long n);
00088   QuotientRing NewZmod(const ZZ& N);
00089   bool IsQuotientRing(const ring& R);
00090   QuotientRing AsQuotientRing(const ring& R);
00091   const ring& BaseRing(const QuotientRing& RmodI);
00092   const ideal& DefiningIdeal(const QuotientRing& RmodI);
00093   const ring& ReprRing(const QuotientRing& RmodI);
00094   const ideal& ReducingIdeal(const QuotientRing& RmodI);
00095   const RingHom& QuotientingHom(const QuotientRing& RmodI);
00096   RingHom InducedHom(const QuotientRing& RmodI, const RingHom& phi);
00097   RingElem CanonicalRepr(ConstRefRingElem r); ///< given x in R/I produces X in R s.t. QuotientingHom(RmodI)(X)=x
00098 
00099   //---------------------------------------------------------------------------
00100 
00101   inline const QuotientRingBase* QuotientRing::operator->() const
00102   {
00103     return static_cast<const QuotientRingBase*>(ring::operator->());
00104   }
00105 
00106 
00107 
00108 
00109   /////////////////////////////////////////////////////////////////////////////
00110   // Inline functions (the order is important).
00111 
00112   inline const ring& BaseRing(const QuotientRing& RmodI)
00113   {
00114     return RmodI->myBaseRing;
00115   }
00116 
00117 
00118   inline const ideal& DefiningIdeal(const QuotientRing& RmodI)
00119   {
00120     return RmodI->myDefiningIdeal;
00121   }
00122 
00123 
00124   inline const ring& ReprRing(const QuotientRing& RmodI)
00125   {
00126     return RmodI->myReprRing;
00127   }
00128 
00129 
00130   inline const ideal& ReducingIdeal(const QuotientRing& RmodI)
00131   {
00132     return RmodI->myReducingIdeal;
00133   }
00134 
00135 
00136 } // end of namespace CoCoA
00137 
00138 
00139 // RCS header/log in the next few lines
00140 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/QuotientRing.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00141 // $Log: QuotientRing.H,v $
00142 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00143 // Imported files
00144 //
00145 // Revision 1.15  2007/03/08 10:23:29  bigatti
00146 // -- CanonHom --> CanonicalHom
00147 //
00148 // Revision 1.14  2007/03/05 21:06:07  cocoa
00149 // New names for homomorphism pseudo-ctors: removed the "New" prefix.
00150 //
00151 // Revision 1.13  2007/03/02 17:46:40  bigatti
00152 // -- unique RingZ and RingQ
00153 // -- requires foundations.H ;  foundations blah;  (think of a better name)
00154 //
00155 // Revision 1.12  2007/02/26 15:00:54  bigatti
00156 // -- added placeholders for new syntax based on unique Z implementation
00157 //
00158 // Revision 1.11  2007/01/11 14:06:15  cocoa
00159 // -- added prefix "raw" to RawPtr arguments names
00160 //
00161 // Revision 1.10  2006/12/18 15:16:05  cocoa
00162 // Added definition of CanonRepr.
00163 //
00164 // Revision 1.9  2006/12/06 17:15:26  cocoa
00165 // -- removed #include "config.H"
00166 //
00167 // Revision 1.8  2006/11/24 17:34:49  cocoa
00168 // -- reorganized includes of header files
00169 //
00170 // Revision 1.7  2006/11/20 15:55:03  cocoa
00171 // ring is now a class again.  Improved definitions of operator-> in derived classes.
00172 //
00173 // Revision 1.6  2006/11/08 16:21:59  cocoa
00174 // Structural cleaning of RingHom; many consequential changes.
00175 //
00176 // Revision 1.5  2006/11/03 14:01:46  cocoa
00177 // -- changed: reference counting in ring, PPMonoids and OrdvArith now
00178 //    uses SmartPtrIRC
00179 //
00180 // Revision 1.4  2006/11/02 13:25:44  cocoa
00181 // Simplification of header files: the OpenMath classes have been renamed.
00182 // Many minor consequential changes.
00183 //
00184 // Revision 1.3  2006/10/06 14:04:15  cocoa
00185 // Corrected position of #ifndef in header files.
00186 // Separated CoCoA_ASSERT into assert.H from config.H;
00187 // many minor consequential changes (have to #include assert.H).
00188 // A little tidying of #include directives (esp. in Max's code).
00189 //
00190 // Revision 1.2  2006/08/07 21:23:25  cocoa
00191 // Removed almost all publicly visible references to SmallExponent_t;
00192 // changed to long in all PPMonoid functions and SparsePolyRing functions.
00193 // DivMask remains to sorted out.
00194 //
00195 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00196 // Imported files
00197 //
00198 // Revision 1.8  2006/05/29 16:22:37  cocoa
00199 // Third time lucky???
00200 // Added myIsInteger member function to all rings (NYI for RingFloat).
00201 //
00202 // Revision 1.7  2006/05/12 16:10:58  cocoa
00203 // Added OpenMathFwd.H, and tidied OpenMath.H.
00204 // Many consequential but trivial changes.
00205 //
00206 // Revision 1.6  2006/04/21 15:01:36  cocoa
00207 // Changed default implementation of RingBase::myGcd -- it now gives a SERIOUS
00208 // error.  All fields must now handle a call to gcd explicitly: they can use
00209 // the new myGcdInField function.  It's now cleaner than it was.
00210 //
00211 // Revision 1.5  2006/03/21 09:43:14  cocoa
00212 // Changed names of some member fns of ideals (dealing with setting and testing
00213 // the flags for primeness and maximality).  Hope icc will complain less now.
00214 //
00215 // Revision 1.4  2006/03/15 18:09:31  cocoa
00216 // Changed names of member functions which print out their object
00217 // into myOutputSelf -- hope this will appease the Intel C++ compiler.
00218 //
00219 // Revision 1.3  2006/03/14 15:01:49  cocoa
00220 // Improved the implementation of ring member fns for computing powers.
00221 // Should keep Intel C++ compiler quieter too.
00222 //
00223 // Revision 1.2  2006/03/12 21:28:34  cocoa
00224 // Major check in after many changes
00225 //
00226 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00227 // Imported files
00228 //
00229 // Revision 1.3  2005/10/14 15:25:07  cocoa
00230 // Major tidying and cleaning to small prime finite fields.
00231 // Several consequential changes.  Improved their documentation.
00232 //
00233 // Added Makefile and script to include/CoCoA/ directory to
00234 // keep library.H up to date.
00235 //
00236 // Revision 1.2  2005/07/08 15:09:29  cocoa
00237 // Added new symbol class (to represent names of indets).
00238 // Integrated the new class into concrete polynomial rings
00239 // and PPMonoid -- many consequential changes.
00240 // Change ctors for the "inline" sparse poly rings: they no
00241 // longer expect a PPMonoid, but build their own instead
00242 // (has to be a PPMonoidOv).
00243 //
00244 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00245 // Imported files
00246 //
00247 // Revision 1.5  2005/04/20 15:40:48  cocoa
00248 // Major change: modified the standard way errors are to be signalled
00249 // (now via a macro which records filename and line number).  Updated
00250 // documentation in error.txt accordingly.
00251 //
00252 // Improved the documentation in matrix.txt (still more work to be done).
00253 //
00254 // Revision 1.4  2005/04/19 14:06:04  cocoa
00255 // Added GPL and GFDL licence stuff.
00256 //
00257 // Revision 1.3  2005/04/01 16:18:20  cocoa
00258 // Friday check-in.  Fixed a bug in the ctor for GeneralQuotientRingImpl.
00259 //
00260 // Revision 1.2  2005/02/11 14:15:20  cocoa
00261 // New style ring elements and references to ring elements;
00262 // I hope I have finally got it right!
00263 //
00264 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00265 // Imported files
00266 //
00267 // Revision 1.17  2004/11/19 15:44:27  cocoa
00268 // Changed names of "casting" functions which convert a ring into
00269 // one with a more special structure (e.g. FractionField).  These
00270 // functions now have names starting with "As".  There were several
00271 // consequential changes.
00272 //
00273 // Revision 1.16  2004/11/18 18:33:41  cocoa
00274 // Now every ring know its own "one" element (as well as "zero").
00275 // Several consequential changes.
00276 //
00277 // Revision 1.15  2004/11/12 15:49:29  cocoa
00278 // Tidying prior to 0.90 release.
00279 // (a) documentation improved (or marked as poor)
00280 // (b) sundry minor improvements to the code
00281 //
00282 // Revision 1.14  2004/11/11 14:26:51  cocoa
00283 // -- added \include *.txt for doxygen
00284 //
00285 // Revision 1.13  2004/11/09 15:50:54  cocoa
00286 // -- changed GeneralQuotientRing --> GeneralQuotientRingImpl
00287 // -- added: NewZmod(Z, N)  with N in ZZ
00288 //
00289 // Revision 1.12  2004/11/04 18:47:43  cocoa
00290 // (1) Ring member functions which previously expected mpz_t args
00291 //     now expect ZZ args.  Numerous minor consequential changes.
00292 // (2) Renamed function which gives access to the mpz_t value inside
00293 //     a ZZ object: previously was raw(...), now is mpzref(...).
00294 //     Plenty of calls had to be altered.
00295 //
00296 // Revision 1.11  2004/07/27 16:03:39  cocoa
00297 // Added IsCommutative test and IamCommutative member function
00298 // to all rings.  Tidied geobuckets a little.
00299 //
00300 // Revision 1.10  2004/06/30 16:46:06  cocoa
00301 // End of day check-in: mostly tidying up, and correcting some
00302 // overly lax access permissions.
00303 //
00304 // Revision 1.9  2004/06/29 17:10:22  cocoa
00305 // Partially tidied use of "protected" and "private" in various
00306 // base classes.  Checking in at the end of the day -- it works,
00307 // and I wouldn't want it to be lost next time point's disk
00308 // misbehaves.
00309 //
00310 // Revision 1.8  2004/05/24 15:52:14  cocoa
00311 // Major update:
00312 //   new error mechanism
00313 //   many fixes
00314 //   RingHoms almost work now
00315 //   RingFloat much improved
00316 //
00317 // Revision 1.7  2004/04/08 15:33:34  cocoa
00318 // Added function IsInteger, and the related RingBase::myIsInteger
00319 // virtual function, plus all necessary implementations.
00320 //
00321 // Revision 1.6  2004/03/20 17:46:10  cocoa
00322 // Check in prior to departure to RWCA
00323 //
00324 // Revision 1.5  2004/02/03 16:16:20  cocoa
00325 // Removed pointless IamGCDDomain functions from several concrete rings.
00326 // Added IamOrderedDomain functions where appropriate.
00327 // Tidied ctors for the small finite fields.
00328 //
00329 // Revision 1.4  2003/10/17 10:51:06  cocoa
00330 // Major cleaning, and new naming convention.
00331 //
00332 // Revision 1.3  2003/10/09 14:55:20  cocoa
00333 // - minor debugging after merge
00334 //
00335 // Revision 1.2  2003/10/09 12:16:38  cocoa
00336 // New coding convention for rings.
00337 //
00338 // Revision 1.2  2003/06/23 16:47:33  abbott
00339 // Minor cleaning prior to public release.
00340 // Updated characteristic and IsIntegralDomain following RingBase.
00341 //
00342 // Revision 1.1  2003/05/14 17:11:54  abbott
00343 // Initial revision
00344 //
00345 
00346 #endif

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