Changeset e44367 in git
- Timestamp:
- Jul 9, 2009, 8:56:40 AM (14 years ago)
- Branches:
- (u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
- Children:
- 2ecec2578a1e225cf98e6ae55a47d2c5df57da4a
- Parents:
- f7feb7574af32456270414d62231a335ffa15060
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/F5cData.cc
rf7feb7 re44367 2 2 * \file F5cData.cc 3 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, 4 * \brief This file includes the inlined methods of the classes \c CPair 5 * and \c Label. 6 * \details This file includes the inlined methods of the class \c CPair, 7 * representing critical pairs in the F5C Algorithm, and the class \c Label, 7 8 * representing the labels in the F5C Algorithm. In this file the handling of 8 9 * these data types is defined. … … 29 30 #include "F5cLists.h" 30 31 31 /*32 * CONSTRUCTOR / DESTRUCTOR of class Label33 */34 32 35 Label::Label(int* expVec) 36 { 33 // IMPLEMENTATIONS OF METHODS OF CLASS LABEL 34 35 36 // constructor / destructor of class Label 37 Label::Label(unsigned int* expVec) { 37 38 m_pExpVec = expVec; 38 39 m_nShortExpVec = computeShortExpVec(m_pExpVec); 39 40 } 40 41 41 Label::~Label() 42 { 42 Label::~Label() { 43 43 delete &m_nShortExpVec; 44 44 delete [] m_pExpVec; 45 45 } 46 46 47 /* 48 * GETTER of class Label 49 */ 50 inline int* Label::getExpVec() 51 { 47 48 // GETTER of class Label 49 unsigned int* Label::getExpVec() { 52 50 return m_pExpVec; 53 51 } 54 52 55 inline unsigned long Label::getShortExpVec() 56 { 53 unsigned long Label::getShortExpVec() { 57 54 return m_nShortExpVec; 58 55 } 59 56 60 /* 61 * SETTER of class Label 62 */ 57 58 // SETTER of class Label 63 59 64 60 65 /* 66 * MISC of class Label 67 */ 68 inline unsigned long Label::computeShortExpVec(int* expVec) 69 { 61 // MISC of class Label 62 unsigned long Label::computeShortExpVec(unsigned int* expVec) { 70 63 //if (p == NULL) return 0; 71 64 unsigned long ev = 0; // short exponent vector … … 74 67 unsigned int i = 0, j=1; 75 68 76 if (n == 0) 77 { 78 if (currRing->N <2*BIT_SIZEOF_LONG) 79 { 69 if (n == 0) { 70 if (currRing->N <2*BIT_SIZEOF_LONG) { 80 71 n=1; 81 72 m1=0; 82 73 } 83 else 84 { 85 for (; j<=(unsigned long) currRing->N; j++) 86 { 74 else { 75 for (; j<=(unsigned long) currRing->N; j++) { 87 76 if (expVec[j] > 0) i++; 88 77 if (i == BIT_SIZEOF_LONG) break; … … 93 82 } 94 83 } 95 else 96 { 84 else { 97 85 m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N); 98 86 } 99 87 100 88 n++; 101 while (i<m1) 102 { 89 while (i<m1) { 103 90 ev |= getBitFields(expVec[j], i, n); 104 91 i += n; … … 107 94 108 95 n--; 109 while (i<BIT_SIZEOF_LONG) 110 { 96 while (i<BIT_SIZEOF_LONG) { 111 97 ev |= getBitFields(expVec[j], i, n); 112 98 i += n; … … 116 102 } 117 103 118 inline unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n) 119 { 104 unsigned long Label::getBitFields(unsigned int e, unsigned int s, unsigned int n) { 120 105 #define Sy_bit_L(x) (((unsigned long)1L)<<(x)) 121 106 unsigned int i = 0; 122 107 unsigned long ev = 0L; 123 108 assume(n > 0 && s < BIT_SIZEOF_LONG); 124 do 125 { 109 do { 126 110 assume(s+i < BIT_SIZEOF_LONG); 127 111 if (e > (int) i) ev |= Sy_bit_L(s+i); … … 133 117 } 134 118 135 119 // END IMPLEMENTATIONS OF METHODS OF CLASS LABEL 136 120 137 121 #endif -
kernel/F5cData.h
rf7feb7 re44367 21 21 class CPair; 22 22 class Label; 23 23 class PolyAndShort; 24 24 25 25 /*! … … 34 34 public: 35 35 36 }; 37 // end CPair 36 }; // end CPair 38 37 39 38 … … 47 46 class Label { 48 47 private: 49 int*m_pExpVec;50 unsigned long 48 unsigned int* m_pExpVec; 49 unsigned long m_nShortExpVec; 51 50 public: 52 51 /*! … … 55 54 * \brief Constructor of an object of class \c Label 56 55 */ 57 Label( int* expVec);56 Label(unsigned int* expVec); 58 57 /*! 59 58 * \fn ~Label(); … … 66 65 * \brief Getter of the \c integer vector at the address \c m_pExpVec 67 66 */ 68 inline int* getExpVec();67 inline unsigned int* getExpVec(); 69 68 /*! 70 69 * \fn static inline long getShortExpVec(); … … 73 72 * 74 73 */ 75 inline unsigned long getShortExpVec(); 74 inline unsigned long getShortExpVec(); 76 75 /*! 77 76 * \fn static inline unsigned long computeShortExpVec(int* expVec); … … 84 83 * polys as input data. 85 84 */ 86 static inline unsigned long computeShortExpVec(int* expVec);85 inline unsigned long computeShortExpVec(unsigned int* expVec); 87 86 /*! 88 87 * \fn static inline unsigned long getBitFields(int e, unsigned int s, … … 102 101 * polys as input data. 103 102 */ 104 static inline unsigned long getBitFields(int e, unsigned int s, unsigned int n); 105 }; 106 // end Label 103 inline unsigned long getBitFields(unsigned int e, unsigned int s, unsigned int n); 104 }; // end Label 107 105 106 /*! 107 * \class PolyAndShort 108 * \author Christian Eder 109 * \brief This is the data structure of a polynomial together with the short 110 * exponent vector of its leading monomial in F5C 111 * \details 112 */ 113 class PolyAndShort { 114 private: 115 poly m_poly; 116 unsigned long m_nShortExpVec; 117 public: 118 /*! 119 * \fn PolyAndShort(poly p); 120 * \param[in] p The polynomial to be stored 121 * \brief Constructor of an object of class \c PolyAndShort 122 * \details Constructor of an object of class \c PolyAndShort used when 123 * inserting an element generating the input ideal \c I of the F5C Algorithm 124 */ 125 PolyAndShort(poly p); 126 /*! 127 * \fn ~Label(); 128 * \brief Destructor of an object of class \c Label 129 */ 130 ~PolyAndShort(); 131 /*! 132 * \fn static inline int getExpVec(); 133 * \return The first entry of the \c integer vector at the address \c m_pExpVec 134 * \brief Getter of the \c integer vector at the address \c m_pExpVec 135 */ 136 inline unsigned int* getExpVec(); 137 /*! 138 * \fn static inline long getShortExpVec(); 139 * \return The short exponent vector \c m_nShortExpVec of the label 140 * \brief Getter of the \code unsigned long m_nShortExpVec \endcode 141 * 142 */ 143 144 }; // end LPoly 108 145 #endif 109 146 // HAVE_F5C -
kernel/f5c.cc
rf7feb7 re44367 26 26 */ 27 27 ideal f5cMain(ideal id, ring r) { 28 return id; 28 Print("SHORT EXP VECTOR 1: %ld\n", pGetShortExpVector(id->m[0])); 29 int* expVec = new int[(r->N)+1]; 30 pGetExpV(id->m[0],expVec); 31 Print("EXP VECTOR 1: %d\n",expVec[1]); 32 Label* label = new Label(expVec); 33 Print("EXP VECTOR 2: %d\n", label->getExpVec()[1]); 34 Print("SHORT EXP VECTOR 2: %ld\n", label->getShortExpVec()); 35 //Print("%ld\n", label->computeShortExpVec(expVec)); 36 Print("SHORT EXP VECTOR 1: %ld\n", pGetShortExpVector(id->m[1])); 37 //int* expVec = new int[(r->N)+1]; 38 pGetExpV(id->m[1],expVec); 39 Print("EXP VECTOR 1: %d\n",expVec[1]); 40 Label* label2 = new Label(expVec); 41 Print("EXP VECTOR 2: %d\n", label2->getExpVec()[1]); 42 Print("SHORT EXP VECTOR 2: %ld\n", label2->getShortExpVec()); 43 44 return id; 29 45 } 30 46 -
kernel/f5c.h
rf7feb7 re44367 16 16 17 17 #endif 18 // HAVE_F5C 18 19 #endif 19 20 // F5C_HEADER
Note: See TracChangeset
for help on using the changeset viewer.