CoCoALib-0.9905 date: 23 May 2007


PPOrdering.H

Go to the documentation of this file.
00001 #ifndef CoCoA_PPOrdering_H
00002 #define CoCoA_PPOrdering_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 #include "CoCoA/SmartPtrIRC.H"
00024 
00025 #include <cstddef>
00026 // using std::size_t;
00027 #include <iosfwd>
00028 // using std::ostream;
00029 
00030 
00031 namespace CoCoA
00032 {
00033 
00034   class OpenMathOutput; // forward declaration -- defined in OpenMath.H
00035   class matrix;         // forward declaration -- defined in matrix.H
00036   class ConstMatrix;    // forward declaration -- defined in matrix.H
00037 
00038   class PPOrderingBase; // forward declaration, defined later in this file
00039 
00040   /*-----------------------------------------------------------------*/
00041   /** \include PPOrdering.txt  */
00042   /*-----------------------------------------------------------------*/
00043   class PPOrdering
00044   {
00045   public:
00046     explicit PPOrdering(const PPOrderingBase* ptr): mySmartPtr(ptr) {}
00047     // assignment disabled because SmartPtrIRC has no assignment
00048     const PPOrderingBase* operator->() const { return mySmartPtr.operator->(); }  ///< Allow const member fns to be called.
00049     const PPOrderingBase* myRawPtr() const { return mySmartPtr.myRawPtr(); } ///< Used by "downcasting" functions Is(..), As(..), etc.
00050     //    bool operator==(const PPOrdering& PPO) const { return mySmartPtr==PPO.mySmartPtr; } // disabled???
00051   private: // data members
00052     SmartPtrIRC<const PPOrderingBase> mySmartPtr;
00053   };
00054 
00055 
00056   std::ostream& operator<<(std::ostream& out, const PPOrdering& PPO);
00057   OpenMathOutput& operator<<(OpenMathOutput& OMOut, const PPOrdering& PPO);
00058 
00059   //---------------------------------------------------------------------------
00060   class PPOrderingBase: private IntrusiveReferenceCount
00061   {
00062     friend class SmartPtrIRC<const PPOrderingBase>; // morally "friend PPOrdering", so it can alter ref count.
00063 
00064   protected:
00065     PPOrderingBase(std::size_t NumIndets, std::size_t GradingDim);
00066     virtual ~PPOrderingBase();
00067   private:
00068     PPOrderingBase(const PPOrderingBase& copy);       ///< NEVER DEFINED -- copy ctor disabled
00069     PPOrderingBase& operator=(const PPOrderingBase&); ///< NEVER DEFINED -- assignment disabled
00070   public:
00071     virtual void myOutputSelf(std::ostream& out) const = 0;
00072     virtual void myOutputSelf(OpenMathOutput& OMOut) const = 0;
00073     virtual void myMatrixCopy(matrix& M) const = 0;
00074 
00075   protected:
00076     friend std::size_t NumIndets(const PPOrdering& PPO);
00077     friend std::size_t GradingDim(const PPOrdering& PPO);
00078 
00079     std::size_t myNumIndets;        ///< Number of indeterminates
00080     std::size_t myGradingDim;       ///< zero if not graded, otherwise grading is in Z^myGradingDim
00081   };
00082 
00083 
00084   //---------------------------------------------------------------------------
00085   // Inline non-member functions
00086 
00087   inline std::size_t NumIndets(const PPOrdering& PPO)
00088   { return PPO->myNumIndets; }
00089 
00090 
00091   inline std::size_t GradingDim(const PPOrdering& PPO)
00092   { return PPO->myGradingDim; }
00093 
00094   //---------------------------------------------------------------------------
00095   // Pseudo-constructors for PPOrderings
00096   PPOrdering NewLexOrdering(std::size_t NumIndets);
00097   PPOrdering NewStdDegLexOrdering(std::size_t NumIndets);
00098   PPOrdering NewStdDegRevLexOrdering(std::size_t NumIndets);
00099   PPOrdering NewMatrixOrdering(std::size_t NumIndets, std::size_t GradingDim, ConstMatrix OrderMatrix);
00100   //  PPOrdering NewMatrixOrderingMod32749(std::size_t NumIndets, std::size_t GradingDim, ConstMatrix OrderMatrix, ConstMatrix InverseOrderMatrix);
00101 
00102 
00103   // Functions for recognizing special PP orderings.
00104   bool IsLex(const PPOrdering& PPO);
00105   bool IsStdDegLex(const PPOrdering& PPO);
00106   bool IsStdDegRevLex(const PPOrdering& PPO);
00107 
00108   matrix GetMatrix(const PPOrdering& PPO);
00109 
00110 
00111 } // end of namespace CoCoA
00112 
00113 
00114 
00115 // RCS header/log in the next few lines
00116 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/PPOrdering.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00117 // $Log: PPOrdering.H,v $
00118 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00119 // Imported files
00120 //
00121 // Revision 1.8  2007/03/08 18:42:06  cocoa
00122 // Cleaned up whitespace.
00123 //
00124 // Revision 1.7  2006/11/27 13:45:56  cocoa
00125 // -- removed #include "config.H"
00126 //
00127 // Revision 1.6  2006/11/24 17:33:26  cocoa
00128 // -- reorganized includes of header files
00129 //
00130 // Revision 1.5  2006/11/22 14:50:33  cocoa
00131 // -- changed: PPOrdering defined as class (instead of typedef)
00132 //
00133 // Revision 1.4  2006/11/14 17:16:20  cocoa
00134 // -- removed commented code for reference counting
00135 //
00136 // Revision 1.3  2006/11/02 13:25:44  cocoa
00137 // Simplification of header files: the OpenMath classes have been renamed.
00138 // Many minor consequential changes.
00139 //
00140 // Revision 1.2  2006/10/06 14:04:15  cocoa
00141 // Corrected position of #ifndef in header files.
00142 // Separated CoCoA_ASSERT into assert.H from config.H;
00143 // many minor consequential changes (have to #include assert.H).
00144 // A little tidying of #include directives (esp. in Max's code).
00145 //
00146 // Revision 1.1.1.1  2006/05/30 11:39:37  cocoa
00147 // Imported files
00148 //
00149 // Revision 1.5  2006/05/12 16:10:58  cocoa
00150 // Added OpenMathFwd.H, and tidied OpenMath.H.
00151 // Many consequential but trivial changes.
00152 //
00153 // Revision 1.4  2006/04/28 16:33:51  cocoa
00154 // Used SmartPtrIRC for PPOrderings.
00155 //
00156 // Revision 1.3  2006/03/15 18:09:31  cocoa
00157 // Changed names of member functions which print out their object
00158 // into myOutputSelf -- hope this will appease the Intel C++ compiler.
00159 //
00160 // Revision 1.2  2006/03/12 21:28:34  cocoa
00161 // Major check in after many changes
00162 //
00163 // Revision 1.1.1.1  2005/10/17 10:46:54  cocoa
00164 // Imported files
00165 //
00166 // Revision 1.1.1.1  2005/05/03 15:47:30  cocoa
00167 // Imported files
00168 //
00169 // Revision 1.4  2005/04/19 15:39:55  cocoa
00170 // Matrices now use reference counts.
00171 //
00172 // Revision 1.3  2005/04/19 14:06:04  cocoa
00173 // Added GPL and GFDL licence stuff.
00174 //
00175 // Revision 1.2  2005/03/02 18:46:41  cocoa
00176 // Added new types ConstRefMatrix, and RefMatrix following along
00177 // the lines of ConstRefRingElem and RefRingElem.  The semantics
00178 // should be a bit clearer now.
00179 //
00180 // Revision 1.1.1.1  2005/01/27 15:12:13  cocoa
00181 // Imported files
00182 //
00183 // Revision 1.13  2004/11/29 16:22:34  cocoa
00184 // -- added function for computing adjoint and inverse for DenseMatrix
00185 //    (so adjoint/inverse matrix is computed by OrdvArith and is no
00186 //    longer needed by PPOrdering)
00187 //
00188 // Revision 1.12  2004/11/11 14:41:16  cocoa
00189 // -- added \include *.txt for doxygen
00190 //
00191 // Revision 1.11  2004/11/05 16:44:20  cocoa
00192 // -- deleted MatrixOrderingMod32749Impl (implemented in OrdvArith)
00193 // -- changed C++ matrices into "matrix" over RingZ
00194 //
00195 // Revision 1.10  2004/11/03 17:54:44  cocoa
00196 // -- added implementation of GetMatrix
00197 // -- added some functions for order matrices modulo 32749:
00198 //    they will be deleted soon
00199 //
00200 // Revision 1.9  2004/11/02 14:49:03  cocoa
00201 // -- new code for matrix orderings
00202 //
00203 // Revision 1.8  2004/10/29 16:09:21  cocoa
00204 // -- added MatrixOrderingMod32749Impl (not tested)
00205 // -- fixed assignment of myAdjointMatrix for MatrixOrderingImpl
00206 //
00207 // Revision 1.7  2004/10/21 17:16:37  cocoa
00208 // Fairly major change: new OrdvArith namspace with various members,
00209 //   new global typedef  SmallExponent_t (defined in config.H).
00210 //
00211 
00212 #endif

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