Changeset 8fc5558 in git for Singular/polys-impl.h
- Timestamp:
- Mar 17, 1998, 11:59:57 AM (26 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 1e9da80e5772d69c637a702b3937bddd689925a4
- Parents:
- 399efbe1493f787ca072ee4e9b85f144549f7bbc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys-impl.h
r399efb r8fc5558 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys-impl.h,v 1.1 8 1998-03-16 14:56:38obachman Exp $ */6 /* $Id: polys-impl.h,v 1.19 1998-03-17 10:59:57 obachman Exp $ */ 7 7 8 8 /*************************************************************** … … 19 19 #include "structs.h" 20 20 #include "mmemory.h" 21 #include "binom.h"22 21 23 22 /*************************************************************** … … 36 35 37 36 typedef long Order_t; 38 // make sure that exp is aligned39 37 struct spolyrec 40 38 { … … 42 40 number coef; 43 41 Order_t Order; 44 #ifdef TEST_MAC_DEBUG 45 Order_t MOrder; 46 #endif 47 monomial exp; 42 monomial exp; // make sure that exp is aligned 48 43 }; 49 44 45 50 46 /*************************************************************** 51 * MACROS CONTROLING MONOMIAL COMPARIONS: 52 53 * COMP_TRADITIONAL 54 Keeps the traditional comparison routines 55 defined -- needed as long as their might be comparisons with 56 negativ components. 57 All the traditional routines are prefixed by t_ 58 59 * COMP_FAST 60 Implements monomial operations using the fast vector 61 techniques and several other extensions which go along with that. 62 Undefine in case there are problems. 63 64 * COMP_STATISTIC 65 Provides several routines for accumulating statistics on monomial 66 comparisons and divisibility tests 67 68 * COMP_DEBUG 69 Turns on debugging of COMP_FAST by comparing the results of fast 70 comparison with traditional comparison 71 72 * COMP_NO_EXP_VECTOR_OPS 73 Like COMP_FAST, except that it turns off "vector techniques" of 74 monomial operations, i.e. does everything exponent-wise. 47 * 48 * variables/defines used for managment of monomials 49 * 75 50 ***************************************************************/ 76 #define COMP_FAST 77 // #define COMP_DEBUG 78 // #define COMP_NO_EXP_VECTOR_OPS 79 #define COMP_TRADITIONAL 80 81 #if defined(COMP_NO_EXP_VECTOR_OPS) && ! defined(COMP_FAST) 82 #define COMP_FAST 83 #endif 84 85 #if defined(COMP_FAST) && ! defined(NDEBUG) 86 #define COMP_DEBUG 87 #endif 88 89 // some relations between these flags 90 #ifdef COMP_DEBUG 91 #define COMP_TRADITIONAL 92 #define COMP_FAST 93 #undef COMP_PROFILE 94 #undef COMP_STATISTICS 95 #endif // COMP_DEBUG 96 97 #ifdef COMP_STATISTICS 98 #undef COMP_FAST 99 #endif // COMP_STATISTICS 100 101 // for the time being COMP_TRADITIONAL always has to be defined, since 102 // traditional routines are needed in spolys.cc -- monomials with 103 // negative exponents are compared there! 104 #define COMP_TRADITIONAL 105 106 /*************************************************************** 107 * 108 * variables used for storage management and monomial traversions 109 * 110 ***************************************************************/ 111 112 // size of poly without exponents 113 #ifdef TEST_MAC_DEBUG 114 #define POLYSIZE (sizeof(poly) + sizeof(number) + 2*sizeof(Order_t)) 115 #else 51 116 52 #define POLYSIZE (sizeof(poly) + sizeof(number) + sizeof(Order_t)) 117 #endif118 53 #define POLYSIZEW (POLYSIZE / sizeof(long)) 119 54 // number of Variables … … 123 58 // size of a monom in units of sizeof(void*) -- i.e. in words 124 59 extern int pMonomSizeW; 125 #ifdef COMP_FAST126 60 // Ceiling((pVariables+1) / sizeof(void*)) == length of exp-vector in words 127 61 extern int pVariables1W; 128 62 // Ceiling((pVariables) / sizeof(void*)) 129 63 extern int pVariablesW; 130 extern int pCompIndex;131 64 extern int pVarOffset; 132 65 extern int pVarLowIndex; 133 66 extern int pVarHighIndex; 134 #else135 #define pCompIndex 0136 #endif137 67 138 68 /*************************************************************** … … 146 76 // 147 77 // BIGENDIAN -- lex order 148 // e_1, e_2, ... , e_n,..,comp : pVarOffset = -1, 149 // pCompIndex = pVariables + #(..) 78 // e_1, e_2, ... , e_n,comp,.. : pVarOffset = -1, 150 79 // pVarLowIndex = 0, 151 80 // pVarHighIndex = pVariables-1 81 // P_COMP_INDEX = pVariables 152 82 // BIGENDIAN -- rev lex order 153 // e_n, ... , e_2, e_1,..,comp : pVarOffset = pVariables, 154 // pCompIndex = pVariables + #(..) 83 // e_n, ... , e_2, e_1,comp,.. : pVarOffset = pVariables, 155 84 // pVarLowIndex = 0, 156 85 // pVarHighIndex = pVariables-1 86 // P_COMP_INDEX = pVariables 157 87 // LITTLEENDIAN -- rev lex order 158 88 // comp,.., e_1, e_2, ... , e_n : pVarOffset = #(..), 159 // pCompIndex = 0,160 89 // pVarLowIndex = 1 + #(..), 161 90 // pVarHighIndex = #(..) + pVariables 91 // P_COMP_INDEX = pVariables 162 92 // LITTLEENDIAN -- lex order 163 93 // comp,..,e_n, .... , e_2, e_1 : pVarOffset = pVariables + 1 + #(..) 164 // pCompIndex = 0165 94 // pVarLowIndex = 1 + #(..) 166 95 // pVarHighIndex = #(..) + pVariables 96 // P_COMP_INDEX = pVariables 167 97 // 168 98 // Furthermore, the size of the exponent vector is always a multiple … … 170 100 // filled in between comp and first/last exponent -- i.e. comp and 171 101 // first/last exponent might not be next to each other 172 173 #ifdef COMP_FAST174 102 175 103 #ifdef WORDS_BIGENDIAN … … 193 121 #endif // WORDS_BIGENDIAN 194 122 195 inline void pGetVarIndicies_Lex(int nvars, 196 int &VarOffset, int &VarCompIndex, 123 inline void pGetVarIndicies_Lex(int nvars, int &VarOffset, 197 124 int &VarLowIndex, int &VarHighIndex) 198 125 { 126 #ifdef WORDS_BIGENDIAN 127 VarOffset = -1; 128 VarLowIndex = 0; 129 VarHighIndex = nvars - 1; 130 #else // ! WORDS_BIGENDIAN 199 131 long temp = (nvars+1)*sizeof(Exponent_t); 200 132 if ((temp % sizeof(long)) == 0) … … 202 134 else 203 135 temp = (temp / sizeof(long)) + 1; // now temp == nvars1W 136 VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1; 137 VarLowIndex = VarHighIndex - nvars + 1; 138 VarOffset = VarHighIndex + 1; 139 #endif // WORDS_BIGENDIAN 140 } 141 142 #define pSetVarIndicies_Lex(nvars) \ 143 pGetVarIndicies_Lex(nvars,pVarOffset,pVarLowIndex,pVarHighIndex) 144 145 146 inline void pGetVarIndicies_RevLex(int nvars, int &VarOffset, 147 int &VarLowIndex, int &VarHighIndex) 148 { 204 149 #ifdef WORDS_BIGENDIAN 205 VarCompIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1; 206 VarOffset = -1; 150 VarOffset = nvars; 207 151 VarLowIndex = 0; 208 VarHighIndex = nvars -1;152 VarHighIndex = nvars-1; 209 153 #else // ! WORDS_BIGENDIAN 210 VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;211 VarCompIndex = 0;212 VarOffset = VarHighIndex + 1;213 VarLowIndex = VarOffset - nvars;214 #endif // WORDS_BIGENDIAN215 }216 #define pSetVarIndicies_Lex(nvars) \217 pGetVarIndicies_Lex(nvars,pVarOffset,pCompIndex,pVarLowIndex,pVarHighIndex)218 219 inline void pGetVarIndicies_RevLex(int nvars,220 int &VarOffset, int &VarCompIndex,221 int &VarLowIndex, int &VarHighIndex)222 {223 154 long temp = (nvars+1)*sizeof(Exponent_t); 224 155 if ((temp % sizeof(long)) == 0) … … 226 157 else 227 158 temp = (temp / sizeof(long)) + 1; 228 #ifdef WORDS_BIGENDIAN229 VarCompIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;230 VarOffset = nvars;231 VarLowIndex = 0;232 VarHighIndex = nvars-1;233 #else // ! WORDS_BIGENDIAN234 // comp, ..., e_1, e_2, ... , e_n235 159 VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1; 236 VarCompIndex = 0;237 160 VarLowIndex = VarHighIndex - nvars + 1; 238 161 VarOffset = VarLowIndex - 1; 239 162 #endif // WORDS_BIGENDIAN 240 163 } 164 #ifdef WORDS_BIGENDIAN 241 165 #define pSetVarIndicies_RevLex(nvars) \ 242 166 pGetVarIndicies_RevLex(nvars,pVarOffset,pCompIndex,pVarLowIndex,pVarHighIndex) 167 #else 168 #define pSetVarIndicies_RevLex(nvars) \ 169 pGetVarIndicies_RevLex(nvars,pVarOffset,pVarLowIndex, pVarLowIndex,pVarHighIndex) 170 #endif 243 171 244 172 // The default settings:
Note: See TracChangeset
for help on using the changeset viewer.