Changeset eb17bd3 in git for Singular/polys-impl.h
- Timestamp:
- Jan 16, 1998, 9:24:06 AM (26 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- Children:
- 0d17129ea525ee2de2129263e6772861595d5a12
- Parents:
- 51bfdb771330882f5a7a80691361ef0ec98f7cbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/polys-impl.h
r51bfdb reb17bd3 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys-impl.h,v 1.1 1 1998-01-15 16:16:23 obachmanExp $ */6 /* $Id: polys-impl.h,v 1.12 1998-01-16 08:24:03 Singular Exp $ */ 7 7 8 8 /*************************************************************** … … 26 26 ***************************************************************/ 27 27 28 // EXPONENT_TYPE is determined by configure und defined in mod2.h 28 // EXPONENT_TYPE is determined by configure und defined in mod2.h 29 29 typedef EXPONENT_TYPE Exponent_t; 30 30 … … 41 41 number coef; 42 42 Order_t Order; 43 #ifdef TEST_MAC_DEBUG 44 Order_t MOrder; 45 #endif 43 46 monomial exp; 44 47 }; … … 47 50 * MACROS CONTROLING MONOMIAL COMPARIONS: 48 51 49 * COMP_TRADITIONAL 52 * COMP_TRADITIONAL 50 53 Keeps the traditional comparison routines 51 54 defined -- needed as long as their might be comparisons with 52 55 negativ components. 53 56 All the traditional routines are prefixed by t_ 54 55 * COMP_FAST 57 58 * COMP_FAST 56 59 Implements monomial operations using the fast vector 57 60 techniques and several other extensions which go along with that. 58 Undefine in case there are problems. 59 60 * COMP_STATISTIC 61 Undefine in case there are problems. 62 63 * COMP_STATISTIC 61 64 Provides several routines for accumulating statistics on monomial 62 65 comparisons and divisibility tests 63 64 * COMP_DEBUG 66 67 * COMP_DEBUG 65 68 Turns on debugging of COMP_FAST by comparing the results of fast 66 69 comparison with traditional comparison … … 68 71 * COMP_NO_EXP_VECTOR_OPS 69 72 Like COMP_FAST, except that it turns off "vector techniques" of 70 monomial operations, i.e. does everything exponent-wise. 73 monomial operations, i.e. does everything exponent-wise. 71 74 ***************************************************************/ 72 75 // #define COMP_FAST … … 107 110 108 111 // size of poly without exponents 112 #ifdef TEST_MAC_DEBUG 113 #define POLYSIZE (sizeof(poly) + sizeof(number) + 2*sizeof(Order_t)) 114 #else 109 115 #define POLYSIZE (sizeof(poly) + sizeof(number) + sizeof(Order_t)) 116 #endif 110 117 #define POLYSIZEW (POLYSIZE / sizeof(long)) 111 118 // number of Variables … … 171 178 (pVarOffset == -1 ? (i) - 1 : pVarOffset - (i)) 172 179 #define _pRingExpIndex(r, i) \ 173 ((r)->VarOffset == -1 ? (i) - 1 : (r)->VarOffset - (i)) 180 ((r)->VarOffset == -1 ? (i) - 1 : (r)->VarOffset - (i)) 174 181 175 182 #else // ! WORDS_BIGENDIAN … … 184 191 185 192 #endif // WORDS_BIGENDIAN 186 193 187 194 inline void pGetVarIndicies_Lex(int nvars, 188 195 int &VarOffset, int &VarCompIndex, … … 235 242 236 243 // The default settings: 237 inline void pGetVarIndicies(int nvars, 244 inline void pGetVarIndicies(int nvars, 238 245 int &VarOffset, int &VarCompIndex, 239 246 int &VarLowIndex, int &VarHighIndex) 240 { 247 { 241 248 pGetVarIndicies_Lex(nvars,VarOffset,VarCompIndex,VarLowIndex,VarHighIndex); 242 249 } … … 250 257 pGetVarIndicies(nvars, pVarOffset, pCompIndex, pVarLowIndex, pVarHighIndex) 251 258 252 259 253 260 #else // ! COMP_FAST 254 261 #define _pExpIndex(i) (i) 255 #define _pRingExpIndex(r,i) (i) 262 #define _pRingExpIndex(r,i) (i) 256 263 #endif // COMP_FAST 257 264 258 265 /*************************************************************** 259 266 * 260 * Primitives for accessing and seeting fields of a poly 267 * Primitives for accessing and seeting fields of a poly 261 268 * 262 269 ***************************************************************/ … … 376 383 #define _pHead(A) pDBHead(A,__FILE__,__LINE__) 377 384 #define _pHead0(A) pDBHead0(A, __FILE__,__LINE__) 378 #ifdef COMP_FAST 385 #ifdef COMP_FAST 379 386 #define _pFetchCopy(r,A) pDBFetchCopy(r, A,__FILE__,__LINE__) 380 387 #else 381 388 #define _pFetchCopy(r,p) pOrdPolyInsertSetm(pCopy(p)) 382 389 #endif 383 390 384 391 #else // ! MDEBUG 385 392 … … 388 395 389 396 #include <string.h> 390 397 391 398 inline poly _pInit(void) 392 399 { … … 419 426 #ifdef DO_PROFILE 420 427 421 #ifndef POLYS_IMPL_CC 428 #ifndef POLYS_IMPL_CC 422 429 #define DECLARE(type, arglist) type arglist; \ 423 430 static type dummy_##arglist 424 431 #else 425 #define DECLARE(type, arglist) type arglist 432 #define DECLARE(type, arglist) type arglist 426 433 #endif // POLYS_IMPL_CC 427 434 428 435 #else //! DO_PROFILE 429 436 430 #define DECLARE(type, arglist ) inline type arglist 431 432 #endif // DO_PROFILE 437 #define DECLARE(type, arglist ) inline type arglist 438 439 #endif // DO_PROFILE 433 440 434 441 … … 440 447 441 448 #ifdef COMP_FAST 442 443 // nice declaration isn't it ?? 449 450 // nice declaration isn't it ?? 444 451 #if defined(PDEBUG) && PDEBUG == 1 445 452 #define pMonAddFast(p1, p2) pDBMonAddFast(p1, p2, __FILE__, __LINE__) … … 454 461 // positive and the sum of two exponents does not exceed 455 462 // EXPONENT_MAX 456 #ifndef COMP_NO_EXP_VECTOR_OPS 463 #ifndef COMP_NO_EXP_VECTOR_OPS 457 464 Exponent_t c2 = _pGetComp(p2); 458 465 int i = pVariables1W; … … 466 473 Exponent_pt s2 = &(p2->exp[pVarLowIndex]); 467 474 #endif 468 475 469 476 for (;;) 470 477 { … … 478 485 // reset comp of p2 479 486 _pSetComp(p2, c2); 480 #endif 487 #endif 488 #ifdef TEST_MAC_ORDER 489 if (bNoAdd) bSetm(p1);else 490 #endif 481 491 _pGetOrder(p1) += _pGetOrder(p2); 482 492 } … … 504 514 const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]); 505 515 const Exponent_t* const ub = s3 + pVariables; 506 // need to zero the "fill in" slots (i.e., empty exponents) 516 // need to zero the "fill in" slots (i.e., empty exponents) 507 517 #ifdef WORDS_BIG_ENDIAN 508 518 *((unsigned long*) p1 + pMonomSize -1) = 0; 509 519 #else 510 520 *((unsigned long *) p1->exp) = 0; 511 #endif 512 #endif 513 521 #endif 522 #endif 523 514 524 for (;;) 515 525 { … … 523 533 // component of p1 is set to comp of p2 524 534 _pSetComp(p1, _pGetComp(p2)); 535 #ifdef TEST_MAC_ORDER 536 if (bNoAdd) bSetm(p1);else 537 #endif 525 538 _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3); 526 539 } 527 540 528 541 // Similar to pCopyAddFast, except that we assume that the component 529 // of p2 and p3 is zero component 542 // of p2 and p3 is zero component 530 543 #if defined(PDEBUG) && PDEBUG == 1 531 544 #define _pCopyAddFast1(p1, p2, p3) pDBCopyAddFast(p1, p2, p3, __FILE__, __LINE__) … … 553 566 #else 554 567 *((unsigned long *) p1->exp) = 0; 555 #endif 556 #endif 568 #endif 569 #endif 557 570 558 571 for (;;) … … 564 577 s2++; 565 578 } 579 #ifdef TEST_MAC_ORDER 580 if (bNoAdd) bSetm(p1);else 581 #endif 566 582 _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3); 567 583 } … … 595 611 const unsigned long* s2; 596 612 const unsigned long* lb; 597 613 598 614 #ifdef WORDS_BIGENDIAN 599 615 lb = (unsigned long*) &(a->exp[0]); … … 612 628 s2 = ((unsigned long*) b) + pMonomSizeW -2; 613 629 } 614 #else // !WORDS_BIGENDIAN 630 #else // !WORDS_BIGENDIAN 615 631 lb = ((unsigned long*) a) + pMonomSizeW; 616 632 if (pVariables & ((SIZEOF_LONG / SIZEOF_EXPONENT) - 1)) … … 624 640 s2 = (unsigned long*) &(b->exp[0]) + 1; 625 641 } 626 #endif 642 #endif 627 643 for (;;) 628 644 { … … 640 656 if (s1 == lb) return TRUE; 641 657 s2++; 642 #endif 658 #endif 643 659 } 644 660 } … … 660 676 s2--; 661 677 } 662 678 663 679 #else // !WORDS_BIGENDIAN 664 680 const Exponent_t* s1 = &(a->exp[pVarLowIndex]); … … 713 729 #endif // defined(PDEBUG) && PDEBUG == 1 714 730 715 731 716 732 DECLARE(BOOLEAN, _pEqual(poly p1, poly p2)) 717 733 { 718 #ifndef COMP_NO_EXP_VECTOR_OPS 734 #ifndef COMP_NO_EXP_VECTOR_OPS 719 735 const long *s1 = (long*) &(p1->exp[0]); 720 736 const long *s2 = (long*) &(p2->exp[0]); … … 725 741 const Exponent_t* const lb = s1 + pVariables; 726 742 if (_pGetComp(p1) != _pGetComp(p2)) return FALSE; 727 #endif 743 #endif 728 744 729 745 for(;;) … … 787 803 788 804 #ifdef TEST_MAC_ORDER 789 extern pSetmProc pSetm;790 805 DECLARE(void, pMonAddFast(poly a, poly m)) 791 806 { 792 807 for(int ii =pVariables; ii; ii--) (a)->exp[ii] += (m)->exp[ii];\ 793 if (bNoAdd) pSetm(a);794 else_pGetOrder(a) += _pGetOrder(m);808 if (bNoAdd) bSetm(a); else 809 _pGetOrder(a) += _pGetOrder(m); 795 810 } 796 811 #else … … 830 845 int j = p->exp[from]; 831 846 int i = from + 1; 832 847 833 848 for(;;) 834 849 { … … 846 861 __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(1)) : \ 847 862 __pExpQuerSum2(p, _pExpIndex(1), _pExpIndex(to))) 848 863 849 864 #define _pExpQuerSum2(p,from,to) \ 850 865 (_pHasReverseExp ? \ … … 858 873 859 874 #endif 860 875 861 876 #endif // POLYS_IMPL_H 862 877
Note: See TracChangeset
for help on using the changeset viewer.