Changeset df3483a in git
- Timestamp:
- Apr 30, 1998, 5:27:25 PM (25 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 24189c4982473a71947501ca9125a109ab40e937
- Parents:
- 1d142c32d3b504db8d82f4aa3104fb6643914101
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/spSpolyLoop.cc
r1d142c rdf3483a 33 33 { 34 34 poly a = monom, // collects the result 35 b = pNew(), // stores a1*monom35 b = NULL, // stores a1*monom 36 36 c; // used for temporary storage 37 37 number tm = pGetCoeff(monom), // coefficient of monom … … 42 42 if (a2==NULL) goto Finish; // we are done if a2 is 0 43 43 44 b = pNew(); 44 45 pCopyAddFast0(b, a1, monom); // now a2 != NULL -- set up b 45 46 … … 66 67 nDelete(&tb); 67 68 pIter(a1); 68 if (a 2 == NULL || a1== NULL) goto Finish; // are we done ?69 if (a1 == NULL || a2 == NULL) goto Finish; // are we done ? 69 70 pCopyAddFast0(b, a1, monom); // No! So, get new b = a1*monom 70 71 goto Top; … … 83 84 a = pNext(a) = b; // append b to result and advance a1 84 85 pIter(a1); 86 if (a1 == NULL) // are we done? 87 { 88 b = NULL; 89 goto Finish; 90 } 85 91 b = pNew(); 86 if (a1 == NULL) goto Finish; // are we done?87 92 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 88 93 goto Top; … … 95 100 spGMultCopyX(a1, monom, a, tneg, spNoether); 96 101 nDelete(&tneg); 97 pFree1(b);102 if (b != NULL) pFree1(b); 98 103 } 99 104 -
Singular/spSpolyLoop.inc
r1d142c rdf3483a 7 7 { 8 8 poly a = monom, // collects the result 9 b = pNew(), // stores a1*monom 10 c; // used for temporary storage 11 number tm = pGetCoeff(monom), // coefficient of monom 12 tneg = npNegM(tm), // - (coefficient of monom) 13 tb; // used for tm*coeff(a1) 14 Order_t order; // used for homog case 15 16 if (a2==NULL) goto Finish; // we are done if a2 is 0 9 b = NULL, // stores a1*monom 10 c; // used for temporary storage 11 number tm = pGetCoeff(monom), // coefficient of monom 12 tneg = npNegM(tm), // - (coefficient of monom) 13 tb; // used for tm*coeff(a1) 14 Order_t order; // used for homog case 15 16 if (a2==NULL) goto Finish; // we are done if a2 is 0 17 b = pNew(); 17 18 18 19 ; // inits order for homog case … … 67 68 a = pNext(a) = b; // append b to result and advance a1 68 69 pIter(a1); 69 b = pNew(); 70 if (a1 == NULL) goto Finish; // are we done? 70 if (a1 == NULL) // are we done? 71 { 72 b = pNew(); 73 goto Finish; 74 } 75 b = pNew(); 71 76 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 72 77 goto Top; … … 80 85 spMultCopyX(a1, monom, a, tneg, spNoether); 81 86 ; 82 pFree1(b);87 if (b != NULL) pFree1(b); 83 88 } 84 89 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwODD … … 86 91 { 87 92 poly a = monom, // collects the result 88 b = pNew(), // stores a1*monom 89 c; // used for temporary storage 90 number tm = pGetCoeff(monom), // coefficient of monom 91 tneg = npNegM(tm), // - (coefficient of monom) 92 tb; // used for tm*coeff(a1) 93 Order_t order; // used for homog case 94 95 if (a2==NULL) goto Finish; // we are done if a2 is 0 93 b = NULL, // stores a1*monom 94 c; // used for temporary storage 95 number tm = pGetCoeff(monom), // coefficient of monom 96 tneg = npNegM(tm), // - (coefficient of monom) 97 tb; // used for tm*coeff(a1) 98 Order_t order; // used for homog case 99 100 if (a2==NULL) goto Finish; // we are done if a2 is 0 101 b = pNew(); 96 102 97 103 ; // inits order for homog case … … 146 152 a = pNext(a) = b; // append b to result and advance a1 147 153 pIter(a1); 148 b = pNew(); 149 if (a1 == NULL) goto Finish; // are we done? 154 if (a1 == NULL) // are we done? 155 { 156 b = pNew(); 157 goto Finish; 158 } 159 b = pNew(); 150 160 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 151 161 goto Top; … … 159 169 spMultCopyX(a1, monom, a, tneg, spNoether); 160 170 ; 161 pFree1(b);171 if (b != NULL) pFree1(b); 162 172 } 163 173 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwONE … … 165 175 { 166 176 poly a = monom, // collects the result 167 b = pNew(), // stores a1*monom 168 c; // used for temporary storage 169 number tm = pGetCoeff(monom), // coefficient of monom 170 tneg = npNegM(tm), // - (coefficient of monom) 171 tb; // used for tm*coeff(a1) 172 Order_t order; // used for homog case 173 174 if (a2==NULL) goto Finish; // we are done if a2 is 0 177 b = NULL, // stores a1*monom 178 c; // used for temporary storage 179 number tm = pGetCoeff(monom), // coefficient of monom 180 tneg = npNegM(tm), // - (coefficient of monom) 181 tb; // used for tm*coeff(a1) 182 Order_t order; // used for homog case 183 184 if (a2==NULL) goto Finish; // we are done if a2 is 0 185 b = pNew(); 175 186 176 187 ; // inits order for homog case … … 225 236 a = pNext(a) = b; // append b to result and advance a1 226 237 pIter(a1); 227 b = pNew(); 228 if (a1 == NULL) goto Finish; // are we done? 238 if (a1 == NULL) // are we done? 239 { 240 b = pNew(); 241 goto Finish; 242 } 243 b = pNew(); 229 244 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 230 245 goto Top; … … 238 253 spMultCopyX(a1, monom, a, tneg, spNoether); 239 254 ; 240 pFree1(b);255 if (b != NULL) pFree1(b); 241 256 } 242 257 static void spSpolyLoop_chMODP_otCOMPEXP_homGEN_nwTWO … … 244 259 { 245 260 poly a = monom, // collects the result 246 b = pNew(), // stores a1*monom 247 c; // used for temporary storage 248 number tm = pGetCoeff(monom), // coefficient of monom 249 tneg = npNegM(tm), // - (coefficient of monom) 250 tb; // used for tm*coeff(a1) 251 Order_t order; // used for homog case 252 253 if (a2==NULL) goto Finish; // we are done if a2 is 0 261 b = NULL, // stores a1*monom 262 c; // used for temporary storage 263 number tm = pGetCoeff(monom), // coefficient of monom 264 tneg = npNegM(tm), // - (coefficient of monom) 265 tb; // used for tm*coeff(a1) 266 Order_t order; // used for homog case 267 268 if (a2==NULL) goto Finish; // we are done if a2 is 0 269 b = pNew(); 254 270 255 271 ; // inits order for homog case … … 304 320 a = pNext(a) = b; // append b to result and advance a1 305 321 pIter(a1); 306 b = pNew(); 307 if (a1 == NULL) goto Finish; // are we done? 322 if (a1 == NULL) // are we done? 323 { 324 b = pNew(); 325 goto Finish; 326 } 327 b = pNew(); 308 328 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 309 329 goto Top; … … 317 337 spMultCopyX(a1, monom, a, tneg, spNoether); 318 338 ; 319 pFree1(b);339 if (b != NULL) pFree1(b); 320 340 } 321 341 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwEVEN … … 323 343 { 324 344 poly a = monom, // collects the result 325 b = pNew(), // stores a1*monom 326 c; // used for temporary storage 327 number tm = pGetCoeff(monom), // coefficient of monom 328 tneg = npNegM(tm), // - (coefficient of monom) 329 tb; // used for tm*coeff(a1) 330 Order_t order; // used for homog case 331 332 if (a2==NULL) goto Finish; // we are done if a2 is 0 345 b = NULL, // stores a1*monom 346 c; // used for temporary storage 347 number tm = pGetCoeff(monom), // coefficient of monom 348 tneg = npNegM(tm), // - (coefficient of monom) 349 tb; // used for tm*coeff(a1) 350 Order_t order; // used for homog case 351 352 if (a2==NULL) goto Finish; // we are done if a2 is 0 353 b = pNew(); 333 354 334 355 order = a2->Order; // inits order for homog case … … 381 402 a = pNext(a) = b; // append b to result and advance a1 382 403 pIter(a1); 383 b = pNew(); 384 if (a1 == NULL) goto Finish; // are we done? 404 if (a1 == NULL) // are we done? 405 { 406 b = pNew(); 407 goto Finish; 408 } 409 b = pNew(); 385 410 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 386 411 goto Top; … … 394 419 spMultCopyX(a1, monom, a, tneg, spNoether); 395 420 ; 396 pFree1(b);421 if (b != NULL) pFree1(b); 397 422 } 398 423 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwODD … … 400 425 { 401 426 poly a = monom, // collects the result 402 b = pNew(), // stores a1*monom 403 c; // used for temporary storage 404 number tm = pGetCoeff(monom), // coefficient of monom 405 tneg = npNegM(tm), // - (coefficient of monom) 406 tb; // used for tm*coeff(a1) 407 Order_t order; // used for homog case 408 409 if (a2==NULL) goto Finish; // we are done if a2 is 0 427 b = NULL, // stores a1*monom 428 c; // used for temporary storage 429 number tm = pGetCoeff(monom), // coefficient of monom 430 tneg = npNegM(tm), // - (coefficient of monom) 431 tb; // used for tm*coeff(a1) 432 Order_t order; // used for homog case 433 434 if (a2==NULL) goto Finish; // we are done if a2 is 0 435 b = pNew(); 410 436 411 437 order = a2->Order; // inits order for homog case … … 458 484 a = pNext(a) = b; // append b to result and advance a1 459 485 pIter(a1); 460 b = pNew(); 461 if (a1 == NULL) goto Finish; // are we done? 486 if (a1 == NULL) // are we done? 487 { 488 b = pNew(); 489 goto Finish; 490 } 491 b = pNew(); 462 492 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 463 493 goto Top; … … 471 501 spMultCopyX(a1, monom, a, tneg, spNoether); 472 502 ; 473 pFree1(b);503 if (b != NULL) pFree1(b); 474 504 } 475 505 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwONE … … 477 507 { 478 508 poly a = monom, // collects the result 479 b = pNew(), // stores a1*monom 480 c; // used for temporary storage 481 number tm = pGetCoeff(monom), // coefficient of monom 482 tneg = npNegM(tm), // - (coefficient of monom) 483 tb; // used for tm*coeff(a1) 484 Order_t order; // used for homog case 485 486 if (a2==NULL) goto Finish; // we are done if a2 is 0 509 b = NULL, // stores a1*monom 510 c; // used for temporary storage 511 number tm = pGetCoeff(monom), // coefficient of monom 512 tneg = npNegM(tm), // - (coefficient of monom) 513 tb; // used for tm*coeff(a1) 514 Order_t order; // used for homog case 515 516 if (a2==NULL) goto Finish; // we are done if a2 is 0 517 b = pNew(); 487 518 488 519 order = a2->Order; // inits order for homog case … … 535 566 a = pNext(a) = b; // append b to result and advance a1 536 567 pIter(a1); 537 b = pNew(); 538 if (a1 == NULL) goto Finish; // are we done? 568 if (a1 == NULL) // are we done? 569 { 570 b = pNew(); 571 goto Finish; 572 } 573 b = pNew(); 539 574 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 540 575 goto Top; … … 548 583 spMultCopyX(a1, monom, a, tneg, spNoether); 549 584 ; 550 pFree1(b);585 if (b != NULL) pFree1(b); 551 586 } 552 587 static void spSpolyLoop_chMODP_otCOMPEXP_homYES_nwTWO … … 554 589 { 555 590 poly a = monom, // collects the result 556 b = pNew(), // stores a1*monom 557 c; // used for temporary storage 558 number tm = pGetCoeff(monom), // coefficient of monom 559 tneg = npNegM(tm), // - (coefficient of monom) 560 tb; // used for tm*coeff(a1) 561 Order_t order; // used for homog case 562 563 if (a2==NULL) goto Finish; // we are done if a2 is 0 591 b = NULL, // stores a1*monom 592 c; // used for temporary storage 593 number tm = pGetCoeff(monom), // coefficient of monom 594 tneg = npNegM(tm), // - (coefficient of monom) 595 tb; // used for tm*coeff(a1) 596 Order_t order; // used for homog case 597 598 if (a2==NULL) goto Finish; // we are done if a2 is 0 599 b = pNew(); 564 600 565 601 order = a2->Order; // inits order for homog case … … 612 648 a = pNext(a) = b; // append b to result and advance a1 613 649 pIter(a1); 614 b = pNew(); 615 if (a1 == NULL) goto Finish; // are we done? 650 if (a1 == NULL) // are we done? 651 { 652 b = pNew(); 653 goto Finish; 654 } 655 b = pNew(); 616 656 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 617 657 goto Top; … … 625 665 spMultCopyX(a1, monom, a, tneg, spNoether); 626 666 ; 627 pFree1(b);667 if (b != NULL) pFree1(b); 628 668 } 629 669 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwEVEN … … 631 671 { 632 672 poly a = monom, // collects the result 633 b = pNew(), // stores a1*monom 634 c; // used for temporary storage 635 number tm = pGetCoeff(monom), // coefficient of monom 636 tneg = npNegM(tm), // - (coefficient of monom) 637 tb; // used for tm*coeff(a1) 638 Order_t order; // used for homog case 639 640 if (a2==NULL) goto Finish; // we are done if a2 is 0 673 b = NULL, // stores a1*monom 674 c; // used for temporary storage 675 number tm = pGetCoeff(monom), // coefficient of monom 676 tneg = npNegM(tm), // - (coefficient of monom) 677 tb; // used for tm*coeff(a1) 678 Order_t order; // used for homog case 679 680 if (a2==NULL) goto Finish; // we are done if a2 is 0 681 b = pNew(); 641 682 642 683 ; // inits order for homog case … … 689 730 a = pNext(a) = b; // append b to result and advance a1 690 731 pIter(a1); 691 b = pNew(); 692 if (a1 == NULL) goto Finish; // are we done? 732 if (a1 == NULL) // are we done? 733 { 734 b = pNew(); 735 goto Finish; 736 } 737 b = pNew(); 693 738 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 694 739 goto Top; … … 702 747 spMultCopyX(a1, monom, a, tneg, spNoether); 703 748 ; 704 pFree1(b);749 if (b != NULL) pFree1(b); 705 750 } 706 751 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwODD … … 708 753 { 709 754 poly a = monom, // collects the result 710 b = pNew(), // stores a1*monom 711 c; // used for temporary storage 712 number tm = pGetCoeff(monom), // coefficient of monom 713 tneg = npNegM(tm), // - (coefficient of monom) 714 tb; // used for tm*coeff(a1) 715 Order_t order; // used for homog case 716 717 if (a2==NULL) goto Finish; // we are done if a2 is 0 755 b = NULL, // stores a1*monom 756 c; // used for temporary storage 757 number tm = pGetCoeff(monom), // coefficient of monom 758 tneg = npNegM(tm), // - (coefficient of monom) 759 tb; // used for tm*coeff(a1) 760 Order_t order; // used for homog case 761 762 if (a2==NULL) goto Finish; // we are done if a2 is 0 763 b = pNew(); 718 764 719 765 ; // inits order for homog case … … 766 812 a = pNext(a) = b; // append b to result and advance a1 767 813 pIter(a1); 768 b = pNew(); 769 if (a1 == NULL) goto Finish; // are we done? 814 if (a1 == NULL) // are we done? 815 { 816 b = pNew(); 817 goto Finish; 818 } 819 b = pNew(); 770 820 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 771 821 goto Top; … … 779 829 spMultCopyX(a1, monom, a, tneg, spNoether); 780 830 ; 781 pFree1(b);831 if (b != NULL) pFree1(b); 782 832 } 783 833 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwONE … … 785 835 { 786 836 poly a = monom, // collects the result 787 b = pNew(), // stores a1*monom 788 c; // used for temporary storage 789 number tm = pGetCoeff(monom), // coefficient of monom 790 tneg = npNegM(tm), // - (coefficient of monom) 791 tb; // used for tm*coeff(a1) 792 Order_t order; // used for homog case 793 794 if (a2==NULL) goto Finish; // we are done if a2 is 0 837 b = NULL, // stores a1*monom 838 c; // used for temporary storage 839 number tm = pGetCoeff(monom), // coefficient of monom 840 tneg = npNegM(tm), // - (coefficient of monom) 841 tb; // used for tm*coeff(a1) 842 Order_t order; // used for homog case 843 844 if (a2==NULL) goto Finish; // we are done if a2 is 0 845 b = pNew(); 795 846 796 847 ; // inits order for homog case … … 843 894 a = pNext(a) = b; // append b to result and advance a1 844 895 pIter(a1); 845 b = pNew(); 846 if (a1 == NULL) goto Finish; // are we done? 896 if (a1 == NULL) // are we done? 897 { 898 b = pNew(); 899 goto Finish; 900 } 901 b = pNew(); 847 902 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 848 903 goto Top; … … 856 911 spMultCopyX(a1, monom, a, tneg, spNoether); 857 912 ; 858 pFree1(b);913 if (b != NULL) pFree1(b); 859 914 } 860 915 static void spSpolyLoop_chMODP_otEXPCOMP_homGEN_nwTWO … … 862 917 { 863 918 poly a = monom, // collects the result 864 b = pNew(), // stores a1*monom 865 c; // used for temporary storage 866 number tm = pGetCoeff(monom), // coefficient of monom 867 tneg = npNegM(tm), // - (coefficient of monom) 868 tb; // used for tm*coeff(a1) 869 Order_t order; // used for homog case 870 871 if (a2==NULL) goto Finish; // we are done if a2 is 0 919 b = NULL, // stores a1*monom 920 c; // used for temporary storage 921 number tm = pGetCoeff(monom), // coefficient of monom 922 tneg = npNegM(tm), // - (coefficient of monom) 923 tb; // used for tm*coeff(a1) 924 Order_t order; // used for homog case 925 926 if (a2==NULL) goto Finish; // we are done if a2 is 0 927 b = pNew(); 872 928 873 929 ; // inits order for homog case … … 920 976 a = pNext(a) = b; // append b to result and advance a1 921 977 pIter(a1); 922 b = pNew(); 923 if (a1 == NULL) goto Finish; // are we done? 978 if (a1 == NULL) // are we done? 979 { 980 b = pNew(); 981 goto Finish; 982 } 983 b = pNew(); 924 984 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 925 985 goto Top; … … 933 993 spMultCopyX(a1, monom, a, tneg, spNoether); 934 994 ; 935 pFree1(b);995 if (b != NULL) pFree1(b); 936 996 } 937 997 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwEVEN … … 939 999 { 940 1000 poly a = monom, // collects the result 941 b = pNew(), // stores a1*monom 942 c; // used for temporary storage 943 number tm = pGetCoeff(monom), // coefficient of monom 944 tneg = npNegM(tm), // - (coefficient of monom) 945 tb; // used for tm*coeff(a1) 946 Order_t order; // used for homog case 947 948 if (a2==NULL) goto Finish; // we are done if a2 is 0 1001 b = NULL, // stores a1*monom 1002 c; // used for temporary storage 1003 number tm = pGetCoeff(monom), // coefficient of monom 1004 tneg = npNegM(tm), // - (coefficient of monom) 1005 tb; // used for tm*coeff(a1) 1006 Order_t order; // used for homog case 1007 1008 if (a2==NULL) goto Finish; // we are done if a2 is 0 1009 b = pNew(); 949 1010 950 1011 order = a2->Order; // inits order for homog case … … 995 1056 a = pNext(a) = b; // append b to result and advance a1 996 1057 pIter(a1); 997 b = pNew(); 998 if (a1 == NULL) goto Finish; // are we done? 1058 if (a1 == NULL) // are we done? 1059 { 1060 b = pNew(); 1061 goto Finish; 1062 } 1063 b = pNew(); 999 1064 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1000 1065 goto Top; … … 1008 1073 spMultCopyX(a1, monom, a, tneg, spNoether); 1009 1074 ; 1010 pFree1(b);1075 if (b != NULL) pFree1(b); 1011 1076 } 1012 1077 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwODD … … 1014 1079 { 1015 1080 poly a = monom, // collects the result 1016 b = pNew(), // stores a1*monom 1017 c; // used for temporary storage 1018 number tm = pGetCoeff(monom), // coefficient of monom 1019 tneg = npNegM(tm), // - (coefficient of monom) 1020 tb; // used for tm*coeff(a1) 1021 Order_t order; // used for homog case 1022 1023 if (a2==NULL) goto Finish; // we are done if a2 is 0 1081 b = NULL, // stores a1*monom 1082 c; // used for temporary storage 1083 number tm = pGetCoeff(monom), // coefficient of monom 1084 tneg = npNegM(tm), // - (coefficient of monom) 1085 tb; // used for tm*coeff(a1) 1086 Order_t order; // used for homog case 1087 1088 if (a2==NULL) goto Finish; // we are done if a2 is 0 1089 b = pNew(); 1024 1090 1025 1091 order = a2->Order; // inits order for homog case … … 1070 1136 a = pNext(a) = b; // append b to result and advance a1 1071 1137 pIter(a1); 1072 b = pNew(); 1073 if (a1 == NULL) goto Finish; // are we done? 1138 if (a1 == NULL) // are we done? 1139 { 1140 b = pNew(); 1141 goto Finish; 1142 } 1143 b = pNew(); 1074 1144 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1075 1145 goto Top; … … 1083 1153 spMultCopyX(a1, monom, a, tneg, spNoether); 1084 1154 ; 1085 pFree1(b);1155 if (b != NULL) pFree1(b); 1086 1156 } 1087 1157 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwONE … … 1089 1159 { 1090 1160 poly a = monom, // collects the result 1091 b = pNew(), // stores a1*monom 1092 c; // used for temporary storage 1093 number tm = pGetCoeff(monom), // coefficient of monom 1094 tneg = npNegM(tm), // - (coefficient of monom) 1095 tb; // used for tm*coeff(a1) 1096 Order_t order; // used for homog case 1097 1098 if (a2==NULL) goto Finish; // we are done if a2 is 0 1161 b = NULL, // stores a1*monom 1162 c; // used for temporary storage 1163 number tm = pGetCoeff(monom), // coefficient of monom 1164 tneg = npNegM(tm), // - (coefficient of monom) 1165 tb; // used for tm*coeff(a1) 1166 Order_t order; // used for homog case 1167 1168 if (a2==NULL) goto Finish; // we are done if a2 is 0 1169 b = pNew(); 1099 1170 1100 1171 order = a2->Order; // inits order for homog case … … 1145 1216 a = pNext(a) = b; // append b to result and advance a1 1146 1217 pIter(a1); 1147 b = pNew(); 1148 if (a1 == NULL) goto Finish; // are we done? 1218 if (a1 == NULL) // are we done? 1219 { 1220 b = pNew(); 1221 goto Finish; 1222 } 1223 b = pNew(); 1149 1224 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1150 1225 goto Top; … … 1158 1233 spMultCopyX(a1, monom, a, tneg, spNoether); 1159 1234 ; 1160 pFree1(b);1235 if (b != NULL) pFree1(b); 1161 1236 } 1162 1237 static void spSpolyLoop_chMODP_otEXPCOMP_homYES_nwTWO … … 1164 1239 { 1165 1240 poly a = monom, // collects the result 1166 b = pNew(), // stores a1*monom 1167 c; // used for temporary storage 1168 number tm = pGetCoeff(monom), // coefficient of monom 1169 tneg = npNegM(tm), // - (coefficient of monom) 1170 tb; // used for tm*coeff(a1) 1171 Order_t order; // used for homog case 1172 1173 if (a2==NULL) goto Finish; // we are done if a2 is 0 1241 b = NULL, // stores a1*monom 1242 c; // used for temporary storage 1243 number tm = pGetCoeff(monom), // coefficient of monom 1244 tneg = npNegM(tm), // - (coefficient of monom) 1245 tb; // used for tm*coeff(a1) 1246 Order_t order; // used for homog case 1247 1248 if (a2==NULL) goto Finish; // we are done if a2 is 0 1249 b = pNew(); 1174 1250 1175 1251 order = a2->Order; // inits order for homog case … … 1220 1296 a = pNext(a) = b; // append b to result and advance a1 1221 1297 pIter(a1); 1222 b = pNew(); 1223 if (a1 == NULL) goto Finish; // are we done? 1298 if (a1 == NULL) // are we done? 1299 { 1300 b = pNew(); 1301 goto Finish; 1302 } 1303 b = pNew(); 1224 1304 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1225 1305 goto Top; … … 1233 1313 spMultCopyX(a1, monom, a, tneg, spNoether); 1234 1314 ; 1235 pFree1(b);1315 if (b != NULL) pFree1(b); 1236 1316 } 1237 1317 static void spSpolyLoop_chMODP_otEXP_homGEN_nwEVEN … … 1239 1319 { 1240 1320 poly a = monom, // collects the result 1241 b = pNew(), // stores a1*monom 1242 c; // used for temporary storage 1243 number tm = pGetCoeff(monom), // coefficient of monom 1244 tneg = npNegM(tm), // - (coefficient of monom) 1245 tb; // used for tm*coeff(a1) 1246 Order_t order; // used for homog case 1247 1248 if (a2==NULL) goto Finish; // we are done if a2 is 0 1321 b = NULL, // stores a1*monom 1322 c; // used for temporary storage 1323 number tm = pGetCoeff(monom), // coefficient of monom 1324 tneg = npNegM(tm), // - (coefficient of monom) 1325 tb; // used for tm*coeff(a1) 1326 Order_t order; // used for homog case 1327 1328 if (a2==NULL) goto Finish; // we are done if a2 is 0 1329 b = pNew(); 1249 1330 1250 1331 ; // inits order for homog case … … 1297 1378 a = pNext(a) = b; // append b to result and advance a1 1298 1379 pIter(a1); 1299 b = pNew(); 1300 if (a1 == NULL) goto Finish; // are we done? 1380 if (a1 == NULL) // are we done? 1381 { 1382 b = pNew(); 1383 goto Finish; 1384 } 1385 b = pNew(); 1301 1386 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 1302 1387 goto Top; … … 1310 1395 spMultCopyX(a1, monom, a, tneg, spNoether); 1311 1396 ; 1312 pFree1(b);1397 if (b != NULL) pFree1(b); 1313 1398 } 1314 1399 static void spSpolyLoop_chMODP_otEXP_homGEN_nwODD … … 1316 1401 { 1317 1402 poly a = monom, // collects the result 1318 b = pNew(), // stores a1*monom 1319 c; // used for temporary storage 1320 number tm = pGetCoeff(monom), // coefficient of monom 1321 tneg = npNegM(tm), // - (coefficient of monom) 1322 tb; // used for tm*coeff(a1) 1323 Order_t order; // used for homog case 1324 1325 if (a2==NULL) goto Finish; // we are done if a2 is 0 1403 b = NULL, // stores a1*monom 1404 c; // used for temporary storage 1405 number tm = pGetCoeff(monom), // coefficient of monom 1406 tneg = npNegM(tm), // - (coefficient of monom) 1407 tb; // used for tm*coeff(a1) 1408 Order_t order; // used for homog case 1409 1410 if (a2==NULL) goto Finish; // we are done if a2 is 0 1411 b = pNew(); 1326 1412 1327 1413 ; // inits order for homog case … … 1374 1460 a = pNext(a) = b; // append b to result and advance a1 1375 1461 pIter(a1); 1376 b = pNew(); 1377 if (a1 == NULL) goto Finish; // are we done? 1462 if (a1 == NULL) // are we done? 1463 { 1464 b = pNew(); 1465 goto Finish; 1466 } 1467 b = pNew(); 1378 1468 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 1379 1469 goto Top; … … 1387 1477 spMultCopyX(a1, monom, a, tneg, spNoether); 1388 1478 ; 1389 pFree1(b);1479 if (b != NULL) pFree1(b); 1390 1480 } 1391 1481 static void spSpolyLoop_chMODP_otEXP_homGEN_nwONE … … 1393 1483 { 1394 1484 poly a = monom, // collects the result 1395 b = pNew(), // stores a1*monom 1396 c; // used for temporary storage 1397 number tm = pGetCoeff(monom), // coefficient of monom 1398 tneg = npNegM(tm), // - (coefficient of monom) 1399 tb; // used for tm*coeff(a1) 1400 Order_t order; // used for homog case 1401 1402 if (a2==NULL) goto Finish; // we are done if a2 is 0 1485 b = NULL, // stores a1*monom 1486 c; // used for temporary storage 1487 number tm = pGetCoeff(monom), // coefficient of monom 1488 tneg = npNegM(tm), // - (coefficient of monom) 1489 tb; // used for tm*coeff(a1) 1490 Order_t order; // used for homog case 1491 1492 if (a2==NULL) goto Finish; // we are done if a2 is 0 1493 b = pNew(); 1403 1494 1404 1495 ; // inits order for homog case … … 1451 1542 a = pNext(a) = b; // append b to result and advance a1 1452 1543 pIter(a1); 1453 b = pNew(); 1454 if (a1 == NULL) goto Finish; // are we done? 1544 if (a1 == NULL) // are we done? 1545 { 1546 b = pNew(); 1547 goto Finish; 1548 } 1549 b = pNew(); 1455 1550 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 1456 1551 goto Top; … … 1464 1559 spMultCopyX(a1, monom, a, tneg, spNoether); 1465 1560 ; 1466 pFree1(b);1561 if (b != NULL) pFree1(b); 1467 1562 } 1468 1563 static void spSpolyLoop_chMODP_otEXP_homGEN_nwTWO … … 1470 1565 { 1471 1566 poly a = monom, // collects the result 1472 b = pNew(), // stores a1*monom 1473 c; // used for temporary storage 1474 number tm = pGetCoeff(monom), // coefficient of monom 1475 tneg = npNegM(tm), // - (coefficient of monom) 1476 tb; // used for tm*coeff(a1) 1477 Order_t order; // used for homog case 1478 1479 if (a2==NULL) goto Finish; // we are done if a2 is 0 1567 b = NULL, // stores a1*monom 1568 c; // used for temporary storage 1569 number tm = pGetCoeff(monom), // coefficient of monom 1570 tneg = npNegM(tm), // - (coefficient of monom) 1571 tb; // used for tm*coeff(a1) 1572 Order_t order; // used for homog case 1573 1574 if (a2==NULL) goto Finish; // we are done if a2 is 0 1575 b = pNew(); 1480 1576 1481 1577 ; // inits order for homog case … … 1528 1624 a = pNext(a) = b; // append b to result and advance a1 1529 1625 pIter(a1); 1530 b = pNew(); 1531 if (a1 == NULL) goto Finish; // are we done? 1626 if (a1 == NULL) // are we done? 1627 { 1628 b = pNew(); 1629 goto Finish; 1630 } 1631 b = pNew(); 1532 1632 pCopyAddFast0(b, a1, monom); // No! So, update b = a1*monom 1533 1633 goto Top; … … 1541 1641 spMultCopyX(a1, monom, a, tneg, spNoether); 1542 1642 ; 1543 pFree1(b);1643 if (b != NULL) pFree1(b); 1544 1644 } 1545 1645 static void spSpolyLoop_chMODP_otEXP_homYES_nwEVEN … … 1547 1647 { 1548 1648 poly a = monom, // collects the result 1549 b = pNew(), // stores a1*monom 1550 c; // used for temporary storage 1551 number tm = pGetCoeff(monom), // coefficient of monom 1552 tneg = npNegM(tm), // - (coefficient of monom) 1553 tb; // used for tm*coeff(a1) 1554 Order_t order; // used for homog case 1555 1556 if (a2==NULL) goto Finish; // we are done if a2 is 0 1649 b = NULL, // stores a1*monom 1650 c; // used for temporary storage 1651 number tm = pGetCoeff(monom), // coefficient of monom 1652 tneg = npNegM(tm), // - (coefficient of monom) 1653 tb; // used for tm*coeff(a1) 1654 Order_t order; // used for homog case 1655 1656 if (a2==NULL) goto Finish; // we are done if a2 is 0 1657 b = pNew(); 1557 1658 1558 1659 order = a2->Order; // inits order for homog case … … 1603 1704 a = pNext(a) = b; // append b to result and advance a1 1604 1705 pIter(a1); 1605 b = pNew(); 1606 if (a1 == NULL) goto Finish; // are we done? 1706 if (a1 == NULL) // are we done? 1707 { 1708 b = pNew(); 1709 goto Finish; 1710 } 1711 b = pNew(); 1607 1712 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1608 1713 goto Top; … … 1616 1721 spMultCopyX(a1, monom, a, tneg, spNoether); 1617 1722 ; 1618 pFree1(b);1723 if (b != NULL) pFree1(b); 1619 1724 } 1620 1725 static void spSpolyLoop_chMODP_otEXP_homYES_nwODD … … 1622 1727 { 1623 1728 poly a = monom, // collects the result 1624 b = pNew(), // stores a1*monom 1625 c; // used for temporary storage 1626 number tm = pGetCoeff(monom), // coefficient of monom 1627 tneg = npNegM(tm), // - (coefficient of monom) 1628 tb; // used for tm*coeff(a1) 1629 Order_t order; // used for homog case 1630 1631 if (a2==NULL) goto Finish; // we are done if a2 is 0 1729 b = NULL, // stores a1*monom 1730 c; // used for temporary storage 1731 number tm = pGetCoeff(monom), // coefficient of monom 1732 tneg = npNegM(tm), // - (coefficient of monom) 1733 tb; // used for tm*coeff(a1) 1734 Order_t order; // used for homog case 1735 1736 if (a2==NULL) goto Finish; // we are done if a2 is 0 1737 b = pNew(); 1632 1738 1633 1739 order = a2->Order; // inits order for homog case … … 1678 1784 a = pNext(a) = b; // append b to result and advance a1 1679 1785 pIter(a1); 1680 b = pNew(); 1681 if (a1 == NULL) goto Finish; // are we done? 1786 if (a1 == NULL) // are we done? 1787 { 1788 b = pNew(); 1789 goto Finish; 1790 } 1791 b = pNew(); 1682 1792 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1683 1793 goto Top; … … 1691 1801 spMultCopyX(a1, monom, a, tneg, spNoether); 1692 1802 ; 1693 pFree1(b);1803 if (b != NULL) pFree1(b); 1694 1804 } 1695 1805 static void spSpolyLoop_chMODP_otEXP_homYES_nwONE … … 1697 1807 { 1698 1808 poly a = monom, // collects the result 1699 b = pNew(), // stores a1*monom 1700 c; // used for temporary storage 1701 number tm = pGetCoeff(monom), // coefficient of monom 1702 tneg = npNegM(tm), // - (coefficient of monom) 1703 tb; // used for tm*coeff(a1) 1704 Order_t order; // used for homog case 1705 1706 if (a2==NULL) goto Finish; // we are done if a2 is 0 1809 b = NULL, // stores a1*monom 1810 c; // used for temporary storage 1811 number tm = pGetCoeff(monom), // coefficient of monom 1812 tneg = npNegM(tm), // - (coefficient of monom) 1813 tb; // used for tm*coeff(a1) 1814 Order_t order; // used for homog case 1815 1816 if (a2==NULL) goto Finish; // we are done if a2 is 0 1817 b = pNew(); 1707 1818 1708 1819 order = a2->Order; // inits order for homog case … … 1753 1864 a = pNext(a) = b; // append b to result and advance a1 1754 1865 pIter(a1); 1755 b = pNew(); 1756 if (a1 == NULL) goto Finish; // are we done? 1866 if (a1 == NULL) // are we done? 1867 { 1868 b = pNew(); 1869 goto Finish; 1870 } 1871 b = pNew(); 1757 1872 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1758 1873 goto Top; … … 1766 1881 spMultCopyX(a1, monom, a, tneg, spNoether); 1767 1882 ; 1768 pFree1(b);1883 if (b != NULL) pFree1(b); 1769 1884 } 1770 1885 static void spSpolyLoop_chMODP_otEXP_homYES_nwTWO … … 1772 1887 { 1773 1888 poly a = monom, // collects the result 1774 b = pNew(), // stores a1*monom 1775 c; // used for temporary storage 1776 number tm = pGetCoeff(monom), // coefficient of monom 1777 tneg = npNegM(tm), // - (coefficient of monom) 1778 tb; // used for tm*coeff(a1) 1779 Order_t order; // used for homog case 1780 1781 if (a2==NULL) goto Finish; // we are done if a2 is 0 1889 b = NULL, // stores a1*monom 1890 c; // used for temporary storage 1891 number tm = pGetCoeff(monom), // coefficient of monom 1892 tneg = npNegM(tm), // - (coefficient of monom) 1893 tb; // used for tm*coeff(a1) 1894 Order_t order; // used for homog case 1895 1896 if (a2==NULL) goto Finish; // we are done if a2 is 0 1897 b = pNew(); 1782 1898 1783 1899 order = a2->Order; // inits order for homog case … … 1828 1944 a = pNext(a) = b; // append b to result and advance a1 1829 1945 pIter(a1); 1830 b = pNew(); 1831 if (a1 == NULL) goto Finish; // are we done? 1946 if (a1 == NULL) // are we done? 1947 { 1948 b = pNew(); 1949 goto Finish; 1950 } 1951 b = pNew(); 1832 1952 pCopyAddFastHomog(b, a1, monom, order); // No! So, update b = a1*monom 1833 1953 goto Top; … … 1841 1961 spMultCopyX(a1, monom, a, tneg, spNoether); 1842 1962 ; 1843 pFree1(b);1963 if (b != NULL) pFree1(b); 1844 1964 } 1845 1965 static spSpolyLoopProc spGetSpolyLoop(Characteristics ch,OrderingTypes ot,Homogs hom,NumWords nw) -
Singular/spSpolyLoop.pl
r1d142c rdf3483a 1 1 #!/usr/local/bin/perl 2 2 ########################################################################### 3 # $Id: spSpolyLoop.pl,v 1. 6 1998-04-06 17:59:36obachman Exp $3 # $Id: spSpolyLoop.pl,v 1.7 1998-04-30 15:27:25 obachman Exp $ 4 4 5 5 ########################################################################### … … 250 250 { 251 251 poly a = monom, // collects the result 252 b = pNew(),// stores a1*monom252 b = NULL, // stores a1*monom 253 253 c; // used for temporary storage 254 254 number tm = pGetCoeff(monom), // coefficient of monom … … 258 258 259 259 if (a2==NULL) goto Finish; // we are done if a2 is 0 260 b = pNew(); 260 261 261 262 CALL_INITORDER(order, a2); // inits order for homog case … … 306 307 a = pNext(a) = b; // append b to result and advance a1 307 308 pIter(a1); 309 if (a1 == NULL) // are we done? 310 { 311 b = pNew(); 312 goto Finish; 313 } 308 314 b = pNew(); 309 if (a1 == NULL) goto Finish; // are we done?310 315 CALL_PCOPYADDFAST(b, a1, monom, order); // No! So, update b = a1*monom 311 316 goto Top; … … 319 324 CALL_MULTCOPYX(a1, monom, a, tneg, spNoether); 320 325 CALL_NDELETE("&tneg"); 321 pFree1(b);326 if (b != NULL) pFree1(b); 322 327 } 323 328 … … 427 432 $res = $res."NonZeroTestA($d, pOrdSgn, goto NotEqual);\n"; 428 433 } 429 $nw = &GetNumWords($argv); 430 $rargv = $rargv."_".$nw; 431 $res = join("_", $res, pMonComp, $ot, $nw); 432 if ($nw eq "nwONE" || $nw eq "nwTWO") 433 { 434 $res = $res."($p1, $p2, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);" 435 } 436 else 437 { 438 $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);"; 439 } 434 # $rargv = $rargv."_nwGEN"; 435 # $res = join("_", $res, pMonComp, $ot, "nwGEN"); 436 # $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);"; 437 $nw = &GetNumWords($argv); 438 $rargv = $rargv."_".$nw; 439 $res = join("_", $res, pMonComp, $ot, $nw); 440 if ($nw eq "nwONE" || $nw eq "nwTWO") 441 { 442 $res = $res."($p1, $p2, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);" 443 } 444 else 445 { 446 $res = $res."($p1, $p2, pVariables1W, $d, NonZeroA($d, pLexSgn, goto NotEqual ), goto Equal);"; 447 } 440 448 return $res; 441 449 }
Note: See TracChangeset
for help on using the changeset viewer.