CoCoALib-0.9905 date: 23 May 2007


ModuleTermOrdering.H

Go to the documentation of this file.
00001 #ifndef CoCoA_ModuleTermOrdering_H
00002 #define CoCoA_ModuleTermOrdering_H
00003 
00004 //   Copyright (c)  2005  John Abbott, Anna Bigatti e Massimo Caboara
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 #include "CoCoA/SmartPtrIRC.H"
00024 #include "CoCoA/degree.H"
00025 #include "CoCoA/ring.H"
00026 #include "CoCoA/PPOrdering.H"
00027 #include "CoCoA/SparsePolyRing.H"
00028 
00029 #include <cstddef>
00030 //using std::size_t;
00031 #include <iosfwd>
00032 //using std::ostream;
00033 #include <vector>
00034 //using std::vector;
00035 
00036 
00037 namespace CoCoA
00038 {
00039 
00040   class OpenMathOutput; // forward declaration -- defined in OpenMath.H
00041 
00042   class ModuleTermOrderingBase; // forward declaration, defined later in this file
00043   /*-----------------------------------------------------------------*/
00044   /** \include ModuleTermOrdering.txt  */
00045   /*-----------------------------------------------------------------*/
00046   class ModuleTermOrdering
00047   {
00048   public:
00049     explicit ModuleTermOrdering(const ModuleTermOrderingBase* ptr): mySmartPtr(ptr) {}
00050     // assignment disabled because SmartPtrIRC has no assignment
00051     const ModuleTermOrderingBase* operator->() const { return mySmartPtr.operator->(); }  ///< Allow const member fns to be called.
00052     const ModuleTermOrderingBase* myRawPtr() const { return mySmartPtr.myRawPtr(); } ///< Used by "downcasting" functions Is(..), As(...) etc.
00053     bool operator==(const ModuleTermOrdering& MTO) const { return mySmartPtr==MTO.mySmartPtr; }
00054   private: // data members
00055     SmartPtrIRC<const ModuleTermOrderingBase> mySmartPtr;
00056   };
00057 
00058 
00059   std::ostream& operator<<(std::ostream& out, const ModuleTermOrdering& MTO);
00060   OpenMathOutput& operator<<(OpenMathOutput& OMOut, const ModuleTermOrdering& MTO);
00061 
00062   //---------------------------------------------------------------------------
00063   class ModuleTermOrderingBase: private IntrusiveReferenceCount
00064   {
00065     friend class SmartPtrIRC<const ModuleTermOrderingBase>; // morally "friend ModuleTermOrdering", so it can alter ref count.
00066 
00067   protected:
00068     ModuleTermOrderingBase(const PPOrdering& PPO, const std::vector<degree>& shifts);
00069     ModuleTermOrderingBase(const PPOrdering& PPO, const std::vector<degree>& shifts, const std::vector<std::size_t>& perm);
00070     virtual ~ModuleTermOrderingBase();
00071   private:
00072     ModuleTermOrderingBase(const ModuleTermOrderingBase& copy);       ///< NEVER DEFINED -- copy ctor disabled
00073     ModuleTermOrderingBase& operator=(const ModuleTermOrderingBase&); ///< NEVER DEFINED -- assignment disabled
00074   public:
00075     virtual void myOutputSelf(std::ostream& out) const;
00076     virtual void myOutputSelf(OpenMathOutput& OMOut) const;
00077     virtual void myOutputName(std::ostream& out) const = 0;
00078     virtual void myOutputName(OpenMathOutput& OMOut) const = 0;
00079     //    virtual void myMatrixCopy(matrix& M) const = 0;
00080     const std::vector<degree>& myShifts() const;
00081     const std::vector<std::size_t>& myPerm() const;
00082     const PPOrdering& myPPOrdering() const;
00083 
00084   protected:
00085     PPOrdering myPPO;                       ///< the PPOrdering (on the base ring)
00086     std::vector<degree> myShiftsValue;      ///< the components shifts (degrees)
00087     std::vector<std::size_t> myPermutationValue;  ///< the components priorities
00088   };
00089 
00090   const std::vector<degree>& shifts(const ModuleTermOrdering& O);
00091   std::size_t NumComponents(const ModuleTermOrdering& MTO);
00092   std::size_t GradingDim(const ModuleTermOrdering& MTO);
00093   const PPOrdering& ModPPOrdering(const ModuleTermOrdering& MTO);
00094 
00095   //---------------------------------------------------------------------------
00096   // Pseudo-constructors for ModuleTermOrderings
00097   ModuleTermOrdering NewWDegTOPos(const PPOrdering& PPO, std::size_t NumComponents);
00098   ModuleTermOrdering NewPosWDegTO(const PPOrdering& PPO, std::size_t NumComponents);
00099   ModuleTermOrdering NewWDegPosTO(const PPOrdering& PPO, std::size_t NumComponents);
00100   ModuleTermOrdering NewWDegTOPos(const PPOrdering& PPO, const std::vector<degree>& shifts);
00101   ModuleTermOrdering NewWDegPosTO(const PPOrdering& PPO, const std::vector<degree>& shifts);
00102   ModuleTermOrdering NewPosWDegTO(const PPOrdering& PPO, const std::vector<degree>& shifts);
00103   ModuleTermOrdering NewWDegTOPos(const PPOrdering& PPO, const std::vector<std::size_t>& perm);
00104   ModuleTermOrdering NewWDegPosTO(const PPOrdering& PPO, const std::vector<std::size_t>& perm);
00105   ModuleTermOrdering NewWDegTOPos(const PPOrdering& PPO, const std::vector<degree>& shifts, const std::vector<std::size_t>& perm);
00106   ModuleTermOrdering NewWDegPosTO(const PPOrdering& PPO, const std::vector<degree>& shifts, const std::vector<std::size_t>& perm);
00107 
00108   //  ModuleTermOrdering NewMatrixOrdering(ConstMatrix OrderMatrix, ??);
00109 
00110   // ??? Compiler bug: the friend declarations below need explicit namespace
00111   //     scoping with g++ 3.2.2, otherwise g++ thinks New... etc are
00112   //     in the CoCoA::MTO namespace.  Very odd!
00113 
00114   // ANNA: philosophical problem: WDeg must include shifts; what about TO?
00115   bool IsWDegTOPos(const ModuleTermOrdering& MTO); // ANNA: change into IsTOPos???
00116   bool IsPosWDegTO(const ModuleTermOrdering& MTO); // ANNA: change into IsPosTO???
00117   bool IsWDegPosTO(const ModuleTermOrdering& MTO);
00118 
00119 } // end of namespace CoCoA
00120 
00121 
00122 
00123 // RCS header/log in the next few lines
00124 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/ModuleTermOrdering.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00125 // $Log: ModuleTermOrdering.H,v $
00126 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00127 // Imported files
00128 //
00129 // Revision 1.7  2006/12/06 17:14:12  cocoa
00130 // -- removed #include "config.H"
00131 //
00132 // Revision 1.6  2006/11/24 17:14:10  cocoa
00133 // -- reorganized includes of header files
00134 // -- SmartPtrIRC for reference counting
00135 //
00136 // Revision 1.5  2006/11/10 13:30:57  cocoa
00137 // -- fixed: "const &" to PPOrdering arguments
00138 // -- some more documentation
00139 //
00140 // Revision 1.4  2006/11/10 13:06:03  cocoa
00141 // -- cleaned code
00142 //
00143 // Revision 1.3  2006/11/02 13:25:44  cocoa
00144 // Simplification of header files: the OpenMath classes have been renamed.
00145 // Many minor consequential changes.
00146 //
00147 // Revision 1.2  2006/10/06 14:04:15  cocoa
00148 // Corrected position of #ifndef in header files.
00149 // Separated CoCoA_ASSERT into assert.H from config.H;
00150 // many minor consequential changes (have to #include assert.H).
00151 // A little tidying of #include directives (esp. in Max's code).
00152 //
00153 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00154 // Imported files
00155 //
00156 // Revision 1.7  2006/05/12 16:10:58  cocoa
00157 // Added OpenMathFwd.H, and tidied OpenMath.H.
00158 // Many consequential but trivial changes.
00159 //
00160 // Revision 1.6  2006/05/11 15:59:23  cocoa
00161 // -- changed reference count is done using SmartPtrIRC
00162 //
00163 // Revision 1.5  2006/05/04 14:19:02  cocoa
00164 // -- moved some code from .H to .C
00165 //
00166 // Revision 1.4  2006/04/28 11:32:17  cocoa
00167 // -- moved concrete class definition from .H to .C
00168 //
00169 // Revision 1.3  2006/03/15 18:09:31  cocoa
00170 // Changed names of member functions which print out their object
00171 // into myOutputSelf -- hope this will appease the Intel C++ compiler.
00172 //
00173 // Revision 1.2  2006/03/12 21:28:34  cocoa
00174 // Major check in after many changes
00175 //
00176 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00177 // Imported files
00178 //
00179 // Revision 1.1  2005/09/28 11:50:35  cocoa
00180 // -- new code for graded modules
00181 //
00182 
00183 #endif

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