Changeset cb66fa in git for Singular/pInline1.h
- Timestamp:
- Sep 14, 2000, 3:04:41 PM (24 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 45f38d6f3e40e1b9a2353cf58170baec48e127c6
- Parents:
- cba51679f82810c5f39ae893f98c5c62821f0297
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/pInline1.h
rcba516 rcb66fa 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 8/00 9 * Version: $Id: pInline1.h,v 1. 1 2000-09-12 16:01:04obachman Exp $9 * Version: $Id: pInline1.h,v 1.2 2000-09-14 13:04:38 obachman Exp $ 10 10 *******************************************************************/ 11 11 #ifndef PINLINE1_H 12 12 #define PINLINE1_H 13 13 14 #ifndef PDIV_DEBUG 14 15 // define to enable debugging/statistics of pShortDivisibleBy 15 16 #undef PDIV_DEBUG 17 #endif 16 18 17 19 #include "mod2.h" … … 49 51 #include "omalloc.h" 50 52 #include "numbers.h" 51 #include "p Inline2.h"53 #include "polys.h" 52 54 #include "p_MemAdd.h" 53 55 #include "p_MemCopy.h" 54 #include "polys.h"55 56 56 57 /*************************************************************** … … 61 62 PINLINE1 poly p_Init(ring r) 62 63 { 63 p_CheckRing (r);64 p_CheckRing1(r); 64 65 poly p; 65 66 omTypeAlloc0Bin(poly, p, r->PolyBin); … … 69 70 PINLINE1 poly p_Init(poly p, ring r) 70 71 { 71 p_CheckPolyRing (p, r);72 p_CheckPolyRing1(p, r); 72 73 poly np; 73 74 omTypeAllocBin(poly, np, r->PolyBin); … … 88 89 { 89 90 if (p == NULL) return NULL; 90 p_CheckPolyRing (p, r);91 p_CheckPolyRing1(p, r); 91 92 poly np; 92 93 omTypeAllocBin(poly, np, r->PolyBin); … … 105 106 PINLINE1 void p_ExpVectorCopy(poly d_p, poly s_p, ring r) 106 107 { 107 p_CheckPolyRing (d_p, r);108 p_CheckPolyRing (s_p, r);108 p_CheckPolyRing1(d_p, r); 109 p_CheckPolyRing1(s_p, r); 109 110 p_MemCopy_LengthGeneral(d_p->exp, s_p->exp, r->ExpLSize); 110 111 } … … 112 113 PINLINE1 void p_ExpVectorAdd(poly p1, poly p2, ring r) 113 114 { 114 p_CheckPolyRing (p1, r);115 p_CheckPolyRing (p2, r);116 #if PDEBUG >= 2115 p_CheckPolyRing1(p1, r); 116 p_CheckPolyRing1(p2, r); 117 #if PDEBUG >= 1 117 118 for (int i=1; i<=r->N; i++) 118 p assume2((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);119 p assume2(!rRing_has_Comp(r) ||p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);119 pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask); 120 pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0); 120 121 #endif 121 122 … … 125 126 PINLINE1 void p_ExpVectorSub(poly p1, poly p2, ring r) 126 127 { 127 p_CheckPolyRing (p1, r);128 p_CheckPolyRing (p2, r);129 #if PDEBUG >= 2128 p_CheckPolyRing1(p1, r); 129 p_CheckPolyRing1(p2, r); 130 #if PDEBUG >= 1 130 131 for (int i=1; i<=r->N; i++) 131 passume2(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r)); 132 passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r)); 132 pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r)); 133 pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 || 134 p_GetComp(p1, r) == p_GetComp(p2, r)); 133 135 #endif 134 136 … … 138 140 PINLINE1 void p_ExpVectorSum(poly pr, poly p1, poly p2, ring r) 139 141 { 140 p_CheckPolyRing(p1, r); 141 p_CheckPolyRing(p2, r); 142 p_CheckPolyRing(pr, r); 142 p_CheckPolyRing1(p1, r); 143 p_CheckPolyRing1(p2, r); 144 p_CheckPolyRing1(pr, r); 145 #if PDEBUG >= 1 146 for (int i=1; i<=r->N; i++) 147 pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask); 148 pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0); 149 #endif 150 151 p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpLSize); 152 } 153 // ExpVector(pr) = ExpVector(p1) - ExpVector(p2) 154 PINLINE1 void p_ExpVectorDiff(poly pr, poly p1, poly p2, ring r) 155 { 156 p_CheckPolyRing1(p1, r); 157 p_CheckPolyRing1(p2, r); 158 p_CheckPolyRing1(pr, r); 143 159 #if PDEBUG >= 2 144 160 for (int i=1; i<=r->N; i++) 145 passume2((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask); 146 passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0); 147 #endif 148 149 p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpLSize); 150 } 151 // ExpVector(pr) = ExpVector(p1) - ExpVector(p2) 152 PINLINE1 void p_ExpVectorDiff(poly pr, poly p1, poly p2, ring r) 153 { 154 p_CheckPolyRing(p1, r); 155 p_CheckPolyRing(p2, r); 156 p_CheckPolyRing(pr, r); 157 #if PDEBUG >= 2 158 for (int i=1; i<=r->N; i++) 159 passume2(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r)); 160 passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r)); 161 pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r)); 162 pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r)); 161 163 #endif 162 164 … … 166 168 PINLINE1 BOOLEAN p_ExpVectorEqual(poly p1, poly p2, ring r) 167 169 { 168 p_CheckPolyRing (p1, r);169 p_CheckPolyRing (p2, r);170 p_CheckPolyRing1(p1, r); 171 p_CheckPolyRing1(p2, r); 170 172 171 173 int i = r->ExpLSize; … … 184 186 PINLINE1 unsigned long p_ExpVectorQuerSum(poly p, ring r) 185 187 { 186 p_CheckPolyRing (p, r);188 p_CheckPolyRing1(p, r); 187 189 unsigned long s = 0; 188 190 unsigned long i = r->N; … … 199 201 PINLINE1 void p_GetExpV(poly p, Exponent_t *ev, ring r) 200 202 { 201 p_CheckPolyRing (p, r);203 p_CheckPolyRing1(p, r); 202 204 for (int j = r->N; j; j--) 203 205 ev[j] = p_GetExp(p, j, r); … … 207 209 PINLINE1 void p_SetExpV(poly p, Exponent_t *ev, ring r) 208 210 { 209 p_CheckPolyRing (p, r);211 p_CheckPolyRing1(p, r); 210 212 for (int j = r->N; j; j--) 211 213 p_SetExp(p, j, ev[j], r); … … 222 224 PINLINE1 int p_LmCmp(poly p, poly q, ring r) 223 225 { 224 p_CheckPolyRing (p, r);225 p_CheckPolyRing (q, r);226 p_CheckPolyRing1(p, r); 227 p_CheckPolyRing1(q, r); 226 228 227 229 p_MemCmp_LengthGeneral_OrdGeneral(p->exp, q->exp, r->pCompLSize, r->ordsgn, … … 231 233 PINLINE1 BOOLEAN p_LmEqual(poly p, poly q, ring r) 232 234 { 233 p_CheckPolyRing (p, r);234 p_CheckPolyRing (q, r);235 p_CheckPolyRing1(p, r); 236 p_CheckPolyRing1(q, r); 235 237 int i = r->ExpLSize; 236 238 unsigned long *ep = p->exp; … … 267 269 { 268 270 int i=r_a->N; 269 p assume1(r_a->N == r_b->N);271 pAssume1(r_a->N == r_b->N); 270 272 271 273 do … … 278 280 return TRUE; 279 281 } 280 PINLINE1 BOOLEAN p_DivisibleBy2(poly a, poly b, ring r) 281 { 282 p_CheckPolyRing(a, r); 283 p_CheckPolyRing(b, r); 284 return _p_DivisibleBy2(a, b, r); 285 } 286 PINLINE1 BOOLEAN p_DivisibleBy1(poly a, poly b, ring r) 287 { 288 p_CheckPolyRing(b, r); 289 p_CheckIf(a != NULL, p_CheckPolyRing(b, r)); 282 static inline BOOLEAN _p_DivisibleBy1(poly a, poly b, ring r) 283 { 290 284 if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)) 291 285 return _p_DivisibleBy2(a, b, r); 292 286 return FALSE; 293 287 } 288 static inline BOOLEAN _p_DivisibleBy1(poly a, ring r_a, poly b, ring r_b) 289 { 290 if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b)) 291 return _p_DivisibleBy2(a, r_a, b, r_b); 292 return FALSE; 293 } 294 295 PINLINE1 BOOLEAN p_DivisibleBy2(poly a, poly b, ring r) 296 { 297 p_CheckPolyRing1(a, r); 298 p_CheckPolyRing1(b, r); 299 return _p_DivisibleBy2(a, b, r); 300 } 301 PINLINE1 BOOLEAN p_DivisibleBy1(poly a, poly b, ring r) 302 { 303 p_CheckPolyRing1(b, r); 304 pIfThen1(a != NULL, p_CheckPolyRing1(b, r)); 305 if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)) 306 return _p_DivisibleBy2(a, b, r); 307 return FALSE; 308 } 294 309 PINLINE1 BOOLEAN p_DivisibleBy(poly a, poly b, ring r) 295 310 { 296 p_CheckPolyRing (b, r);297 p _CheckIf(a!=NULL, p_CheckPolyRing(a, r));311 p_CheckPolyRing1(b, r); 312 pIfThen1(a!=NULL, p_CheckPolyRing1(a, r)); 298 313 299 314 if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))) … … 305 320 poly b, unsigned long not_sev_b, ring r) 306 321 { 307 p_CheckPolyRing (a, r);308 p_CheckPolyRing (b, r);322 p_CheckPolyRing1(a, r); 323 p_CheckPolyRing1(b, r); 309 324 #ifndef PDIV_DEBUG 310 passume2(p_GetShortExpVector(a, r) == sev_a);311 passume2(p_GetShortExpVector(b, r) == ~ not_sev_b);325 _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r); 326 _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r); 312 327 313 328 if (sev_a & not_sev_b) 314 329 { 315 p assume2(p_DivisibleBy2(a, b, r) == FALSE);330 pAssume1(p_DivisibleBy2(a, b, r) == FALSE); 316 331 return FALSE; 317 332 } … … 319 334 #else 320 335 return pDebugShortDivisibleBy(a, sev_a, r, b, not_sev_b, r); 336 #endif 337 } 338 339 PINLINE1 BOOLEAN p_ShortDivisibleBy(poly a, unsigned long sev_a, ring r_a, 340 poly b, unsigned long not_sev_b, ring r_b) 341 { 342 p_CheckPolyRing1(a, r_a); 343 p_CheckPolyRing1(b, r_b); 344 #ifndef PDIV_DEBUG 345 _pPolyAssume2(p_GetShortExpVector(a, r_a) == sev_a, a, r_a); 346 _pPolyAssume2(p_GetShortExpVector(b, r_b) == ~ not_sev_b, b, r_b); 347 348 if (sev_a & not_sev_b) 349 { 350 pAssume1(_p_DivisibleBy2(a, r_a, b, r_b) == FALSE); 351 return FALSE; 352 } 353 return _p_DivisibleBy1(a, r_a, b, r_b); 354 #else 355 return pDebugShortDivisibleBy(a, sev_a, r_a, b, not_sev_b, r_b); 321 356 #endif 322 357 }
Note: See TracChangeset
for help on using the changeset viewer.