Changeset b1ff71 in git
- Timestamp:
- Jul 14, 2010, 11:01:55 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 81104ed2dadbfad0477badcdf86b06b1a0b0e59c
- Parents:
- 29c5bddc7323e57463888d471da9ef0f6645cb2e
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r29c5bd rb1ff71 1048 1048 b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD 1049 1049 if ((a!=NULL) && (b!=NULL) 1050 && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing), currRing->bitmask)))1050 && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask))) 1051 1051 { 1052 1052 Werror("OVERFLOW in mult(d=%ld, d=%ld, max=%ld)", … … 1063 1063 b=pCopy((poly)v->Data()); 1064 1064 if ((a!=NULL) && (b!=NULL) 1065 && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing), currRing->bitmask)))1065 && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask))) 1066 1066 { 1067 1067 Werror("OVERFLOW in mult(d=%ld, d=%ld, max=%ld)", -
kernel/maps.cc
r29c5bd rb1ff71 409 409 for(j=N-1;j>=0;j--) 410 410 { 411 m[j]=si_max(m[j], p_GetExp( p,j+1,preimage_r));411 m[j]=si_max(m[j],(int)p_GetExp( p,j+1,preimage_r)); 412 412 if (m[j]>=MAX_MAP_DEG) 413 413 { … … 443 443 for(j=N-1;j>=0;j--) 444 444 { 445 m[j]=si_max(m[j], p_GetExp(p,j+1,preimage_r));445 m[j]=si_max(m[j],(int)p_GetExp(p,j+1,preimage_r)); 446 446 if (m[j]>=MAX_MAP_DEG) 447 447 { -
kernel/pInline2.h
r29c5bd rb1ff71 113 113 /// 2. number of bits to shift to the right in the upper 8 bits (which takes at most 6 bits for 64 bit) 114 114 /// Thus VarOffset always has 2 zero higher bits! 115 PINLINE2 intp_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)115 PINLINE2 long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset) 116 116 { 117 117 pAssume2((VarOffset >> (24 + 6)) == 0); … … 119 119 int pos=(VarOffset & 0xffffff); 120 120 int bitpos=(VarOffset >> 24); 121 intexp=(p->exp[pos] >> bitmask) & iBitmask;121 unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask; 122 122 return exp; 123 123 #else 124 return ( int)124 return (long) 125 125 ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24)) 126 126 & iBitmask); … … 132 132 /// @Note: 133 133 /// VarOffset encodes the position in p->exp @see p_GetExp 134 PINLINE2 int p_SetExp(poly p, const inte, const unsigned long iBitmask, const int VarOffset)134 PINLINE2 unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset) 135 135 { 136 136 pAssume2(e>=0); 137 pAssume2( (unsigned long)e<=iBitmask);137 pAssume2(e<=iBitmask); 138 138 pAssume2((VarOffset >> (24 + 6)) == 0); 139 139 140 140 // shift e to the left: 141 141 register int shift = VarOffset >> 24; 142 unsigned long ee = ((unsigned long)e)<< shift /*(VarOffset >> 24)*/;142 unsigned long ee = e << shift /*(VarOffset >> 24)*/; 143 143 // find the bits in the exponent vector 144 144 register int offset = (VarOffset & 0xffffff); … … 165 165 166 166 /// @Note: we may add some more info (6 ) into VarOffset and thus encode 167 PINLINE2 intp_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)167 PINLINE2 long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset) 168 168 { 169 169 int pos =(VarOffset & 0xffffff); 170 170 int hbyte= (VarOffset >> 24); // the highest byte 171 171 int bitpos = hbyte & 0x3f; // last 6 bits 172 intbitmask = BitMask(iBitmask, hbyte >> 6);173 174 intexp=(p->exp[pos] >> bitpos) & bitmask;172 long bitmask = BitMask(iBitmask, hbyte >> 6); 173 174 long exp=(p->exp[pos] >> bitpos) & bitmask; 175 175 return exp; 176 176 177 177 } 178 178 179 PINLINE2 int p_SetExp(poly p, const inte, const unsigned long iBitmask, const int VarOffset)179 PINLINE2 long p_SetExp(poly p, const long e, const unsigned long iBitmask, const int VarOffset) 180 180 { 181 181 pAssume2(e>=0); 182 pAssume2( (unsigned long)e <= BitMask(iBitmask, VarOffset >> 30));182 pAssume2(e <= BitMask(iBitmask, VarOffset >> 30)); 183 183 184 184 // shift e to the left: … … 186 186 int bitmask = BitMask(iBitmask, hbyte >> 6); 187 187 register int shift = hbyte & 0x3f; 188 unsigned long ee = ((unsigned long)e)<< shift;188 long ee = e << shift; 189 189 // find the bits in the exponent vector 190 190 register int offset = (VarOffset & 0xffffff); … … 199 199 200 200 201 PINLINE2 intp_GetExp(const poly p, const ring r, const int VarOffset)201 PINLINE2 long p_GetExp(const poly p, const ring r, const int VarOffset) 202 202 { 203 203 p_LmCheckPolyRing2(p, r); … … 206 206 } 207 207 208 PINLINE2 int p_SetExp(poly p, const inte, const ring r, const int VarOffset)208 PINLINE2 long p_SetExp(poly p, const long e, const ring r, const int VarOffset) 209 209 { 210 210 p_LmCheckPolyRing2(p, r); … … 216 216 217 217 /// get v^th exponent for a monomial 218 PINLINE2 intp_GetExp(const poly p, const int v, const ring r)218 PINLINE2 long p_GetExp(const poly p, const int v, const ring r) 219 219 { 220 220 p_LmCheckPolyRing2(p, r); … … 226 226 227 227 /// set v^th exponent for a monomial 228 PINLINE2 int p_SetExp(poly p, const int v, const inte, const ring r)228 PINLINE2 long p_SetExp(poly p, const int v, const long e, const ring r) 229 229 { 230 230 p_LmCheckPolyRing2(p, r); … … 239 239 240 240 // the following should be implemented more efficiently 241 PINLINE2 intp_IncrExp(poly p, int v, ring r)241 PINLINE2 long p_IncrExp(poly p, int v, ring r) 242 242 { 243 243 p_LmCheckPolyRing2(p, r); … … 246 246 return p_SetExp(p,v,e,r); 247 247 } 248 PINLINE2 intp_DecrExp(poly p, int v, ring r)248 PINLINE2 long p_DecrExp(poly p, int v, ring r) 249 249 { 250 250 p_LmCheckPolyRing2(p, r); … … 254 254 return p_SetExp(p,v,e,r); 255 255 } 256 PINLINE2 int p_AddExp(poly p, int v, intee, ring r)256 PINLINE2 long p_AddExp(poly p, int v, long ee, ring r) 257 257 { 258 258 p_LmCheckPolyRing2(p, r); … … 261 261 return p_SetExp(p,v,e,r); 262 262 } 263 PINLINE2 int p_SubExp(poly p, int v, intee, ring r)264 { 265 p_LmCheckPolyRing2(p, r); 266 inte = p_GetExp(p,v,r);263 PINLINE2 long p_SubExp(poly p, int v, long ee, ring r) 264 { 265 p_LmCheckPolyRing2(p, r); 266 long e = p_GetExp(p,v,r); 267 267 pAssume2(e >= ee); 268 268 e -= ee; 269 269 return p_SetExp(p,v,e,r); 270 270 } 271 PINLINE2 int p_MultExp(poly p, int v, intee, ring r)272 { 273 p_LmCheckPolyRing2(p, r); 274 inte = p_GetExp(p,v,r);271 PINLINE2 long p_MultExp(poly p, int v, long ee, ring r) 272 { 273 p_LmCheckPolyRing2(p, r); 274 long e = p_GetExp(p,v,r); 275 275 e *= ee; 276 276 return p_SetExp(p,v,e,r); 277 277 } 278 278 279 PINLINE2 intp_GetExpSum(poly p1, poly p2, int i, ring r)279 PINLINE2 long p_GetExpSum(poly p1, poly p2, int i, ring r) 280 280 { 281 281 p_LmCheckPolyRing2(p1, r); … … 283 283 return p_GetExp(p1,i,r) + p_GetExp(p2,i,r); 284 284 } 285 PINLINE2 intp_GetExpDiff(poly p1, poly p2, int i, ring r)285 PINLINE2 long p_GetExpDiff(poly p1, poly p2, int i, ring r) 286 286 { 287 287 return p_GetExp(p1,i,r) - p_GetExp(p2,i,r); -
kernel/p_polys.cc
r29c5bd rb1ff71 409 409 { 410 410 p_LmCheckPolyRing(p, r); 411 return (long) 411 return (long)p_ExpVectorQuerSum(p, r); 412 412 } 413 413 -
kernel/p_polys.h
r29c5bd rb1ff71 76 76 77 77 // Exponent 78 PINLINE2 intp_GetExp(poly p, int v, ring r);79 PINLINE2 int p_SetExp(poly p, int v, inte, ring r);80 PINLINE2 intp_IncrExp(poly p, int v, ring r);81 PINLINE2 intp_DecrExp(poly p, int v, ring r);82 PINLINE2 int p_AddExp(poly p, int v, intee, ring r);83 PINLINE2 int p_SubExp(poly p, int v, intee, ring r);84 PINLINE2 int p_MultExp(poly p, int v, intee, ring r);85 PINLINE2 intp_GetExpSum(poly p1, poly p2, int i, ring r);86 PINLINE2 intp_GetExpDiff(poly p1, poly p2, int i, ring r);78 PINLINE2 long p_GetExp(poly p, int v, ring r); 79 PINLINE2 long p_SetExp(poly p, int v, long e, ring r); 80 PINLINE2 long p_IncrExp(poly p, int v, ring r); 81 PINLINE2 long p_DecrExp(poly p, int v, ring r); 82 PINLINE2 long p_AddExp(poly p, int v, long ee, ring r); 83 PINLINE2 long p_SubExp(poly p, int v, long ee, ring r); 84 PINLINE2 long p_MultExp(poly p, int v, long ee, ring r); 85 PINLINE2 long p_GetExpSum(poly p1, poly p2, int i, ring r); 86 PINLINE2 long p_GetExpDiff(poly p1, poly p2, int i, ring r); 87 87 88 88 /*************************************************************** -
kernel/ring.cc
r29c5bd rb1ff71 4106 4106 PrintLn(); 4107 4107 Print("v0:%ld ",p_GetComp(p, r)); 4108 for(i=1;i<=r->N;i++) Print(" v%d:% d",i,p_GetExp(p,i, r));4108 for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r)); 4109 4109 PrintLn(); 4110 4110 pIter(p); … … 4128 4128 PrintLn(); 4129 4129 Print("v0:%9ld ", p_GetComp(p, R)); 4130 for(int i = 1; i <= R->N; i++) Print(" v%d:%5 d",i, p_GetExp(p, i, R));4130 for(int i = 1; i <= R->N; i++) Print(" v%d:%5ld",i, p_GetExp(p, i, R)); 4131 4131 PrintLn(); 4132 4132 } -
kernel/structs.h
r29c5bd rb1ff71 651 651 static inline int si_min(const int a, const int b) { return (a<b) ? a : b; } 652 652 static inline long si_max(const long a, const long b) { return (a>b) ? a : b; } 653 static inline unsigned long si_max(const unsigned long a, const unsigned long b) { return (a>b) ? a : b; } 653 654 static inline long si_min(const long a, const long b) { return (a<b) ? a : b; } 655 static inline unsigned long si_min(const unsigned long a, const unsigned long b) { return (a<b) ? a : b; } 654 656 #else 655 657 #define si_max(A,B) ((A) > (B) ? (A) : (B))
Note: See TracChangeset
for help on using the changeset viewer.