Changeset 642e65 in git
- Timestamp:
- Jul 7, 2009, 8:54:56 PM (14 years ago)
- Branches:
- (u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
- Children:
- ab3db62fd566bf974e5dcf6da2405b18b464b0c4
- Parents:
- e9f5b23f3e4572bcb33e40a8f5debc2ca9bd11a6
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/F5cData.cc
re9f5b2 r642e65 1 /*! 2 * \file F5cData.cc 3 * \author Christian Eder 4 * \brief This file includes the inlined methods of the classes CPair and Rule. 5 * \details This file include the inlined methods of the class CPair, 6 * representing critical pairs in the F5C Algorithm, and the class Rule, 7 * representing the labels in the F5C Algorithm. In this file the handling of 8 * these data types is defined. 9 */ 10 1 11 #include "mod2.h" 2 12 … … 18 28 #include "F5cData.h" 19 29 #include "F5cLists.h" 30 20 31 /* 21 ===================== 22 everything is inlined 23 ===================== 24 */ 32 * CONSTRUCTOR / DESTRUCTOR of class Label 33 */ 34 35 Label::Label(int* expVec) 36 { 37 m_pExpVec = expVec; 38 m_nShortExpVec = computeShortExpVec(m_pExpVec); 39 } 40 41 Label::~Label() 42 { 43 delete &m_nShortExpVec; 44 delete [] m_pExpVec; 45 } 46 47 /* 48 * GETTER of class Label 49 */ 50 inline int* Label::getExpVec() 51 { 52 return m_pExpVec; 53 } 54 55 inline unsigned long Label::getShortExpVec() 56 { 57 return m_nShortExpVec; 58 } 59 60 /* 61 * SETTER of class Label 62 */ 63 64 65 /* 66 * MISC of class Label 67 */ 68 inline unsigned long Label::computeShortExpVec(int* expVec) 69 { 70 //if (p == NULL) return 0; 71 unsigned long ev = 0; // short exponent vector 72 unsigned int n = BIT_SIZEOF_LONG / currRing->N; // number of bits per exp 73 unsigned int m1; // highest bit which is filled with (n+1) 74 unsigned int i = 0, j=1; 75 76 if (n == 0) 77 { 78 if (currRing->N <2*BIT_SIZEOF_LONG) 79 { 80 n=1; 81 m1=0; 82 } 83 else 84 { 85 for (; j<=(unsigned long) currRing->N; j++) 86 { 87 if (expVec[j] > 0) i++; 88 if (i == BIT_SIZEOF_LONG) break; 89 } 90 if (i>0) 91 ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i)); 92 return ev; 93 } 94 } 95 else 96 { 97 m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N); 98 } 99 100 n++; 101 while (i<m1) 102 { 103 ev |= getBitFields(expVec[j], i, n); 104 i += n; 105 j++; 106 } 107 108 n--; 109 while (i<BIT_SIZEOF_LONG) 110 { 111 ev |= getBitFields(expVec[j], i, n); 112 i += n; 113 j++; 114 } 115 return ev; 116 } 117 118 inline unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n) 119 { 120 #define Sy_bit_L(x) (((unsigned long)1L)<<(x)) 121 unsigned int i = 0; 122 unsigned long ev = 0L; 123 assume(n > 0 && s < BIT_SIZEOF_LONG); 124 do 125 { 126 assume(s+i < BIT_SIZEOF_LONG); 127 if (e > (int) i) ev |= Sy_bit_L(s+i); 128 else break; 129 i++; 130 } 131 while (i < n); 132 return ev; 133 } 134 135 136 25 137 #endif 26 // HAVE_F5 c138 // HAVE_F5C -
kernel/F5cData.h
re9f5b2 r642e65 1 /*! 2 * \file F5cData.h 3 * \author Christian Eder 4 * \date 07/07/2009 5 * \version 0.01 6 * \brief Declarations of the classes CPair and Rule. 7 * \details This file contains the declarations of the class \c CPair, representing 8 * critical pairs, and the class \c Label, representing the labels, in the F5C 9 * Algorithm. All methods are inlined. 10 */ 11 1 12 #ifndef F5CDATA_HEADER 2 13 #define F5CDATA_HEADER 3 14 #ifdef HAVE_F5C 15 16 /*! 17 * class definitions of the needed datatypes in the F5C algorithm: 18 * (a) critical pairs 19 * (b) labels 20 */ 21 class CPair; 22 class Label; 23 24 25 /*! 26 * \class CPair 27 * \author Christian Eder 28 * \brief This is the data structure of a critical pair in the F5C implementation. 29 * \details 30 */ 31 class CPair { 32 private: 33 34 public: 35 36 }; 37 // end CPair 38 39 40 /*! 41 * \class Label 42 * \author Christian Eder 43 * \brief This is the data structure of a rule, i.e. a label in the F5C 44 * Algorithm. 45 * \details 46 */ 47 class Label { 48 private: 49 int* m_pExpVec; 50 unsigned long m_nShortExpVec; 51 public: 52 /*! 53 * \fn Label(int* expVec); 54 * \param[in] expVec The exponent vector of some monomial defining a label 55 * \brief Constructor of an object of class \c Label 56 */ 57 Label(int* expVec); 58 /*! 59 * \fn ~Label(); 60 * \brief Destructor of an object of class \c Label 61 */ 62 ~Label(); 63 /*! 64 * \fn static inline int getExpVec(); 65 * \return The first entry of the \c integer vector at the address \c m_pExpVec 66 * \brief Getter of the \c integer vector at the address \c m_pExpVec 67 */ 68 inline int* getExpVec(); 69 /*! 70 * \fn static inline long getShortExpVec(); 71 * \return The short exponent vector \c m_nShortExpVec of the label 72 * \brief Getter of the \code unsigned long m_nShortExpVec \endcode 73 * 74 */ 75 inline unsigned long getShortExpVec(); 76 /*! 77 * \fn static inline unsigned long computeShortExpVec(int* expVec); 78 * \param[in] expVec The exponent vector of some monomial defining a label 79 * \return Short exponent vector of type \code unsigned long \endcode 80 * \brief Computation of the short exponent vector of type \code unsigned 81 * long \endcode of the exponent vector \c expVec 82 * \note This method is originally in polys-impl.cc, in this version here it 83 * is optimized for the case of working with exponent vectors and not with 84 * polys as input data. 85 */ 86 static inline unsigned long computeShortExpVec(int* expVec); 87 /*! 88 * \fn static inline unsigned long getBitFields(int e, unsigned int s, 89 * unsigned int n); 90 * \param[in] e Entry of the exponent vector 91 * \param[in] s Integer smaller than the bitsize of \c long 92 * \param[in] n Integer representing the number of bits per entry of the 93 * exponent vector \c expVec 94 * \return \code unsigned long \endcode the bitfield for the input data 95 * \brief Computation of the bitfield of type \code unsigned long \endcode 96 * for an entry \c e of the given exponent vector \c expVec at an iteration 97 * step where \c s iterates over all \c integers smaller than the bitsize of 98 * \c long, and \c n iterates over the number of bits per entry of the 99 * exponent vector \c expVec 100 * \note This method is originally in polys-impl.cc, in this version here it 101 * is optimized for the case of working with exponent vectors and not with 102 * polys as input data. 103 */ 104 static inline unsigned long getBitFields(int e, unsigned int s, unsigned int n); 105 }; 106 // end Label 4 107 5 108 #endif
Note: See TracChangeset
for help on using the changeset viewer.