Changeset 4eba3ad in git for dyn_modules
- Timestamp:
- Apr 28, 2014, 8:49:00 PM (10 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- c7d29b194535c9015230fc587b2ae178c075ef3e
- Parents:
- 92992c08c2f387188f53d5f874a342fb60dccc06
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-04-28 20:49:00+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:46+02:00
- Location:
- dyn_modules/syzextra
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
dyn_modules/syzextra/mod_main.cc
r92992c r4eba3ad 506 506 507 507 508 508 509 static BOOLEAN _ComputeLeadingSyzygyTerms(leftv res, leftv h) 509 510 { 511 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 512 513 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 514 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 515 const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 516 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 517 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 518 510 519 const ring r = currRing; 511 520 NoReturn(res); … … 518 527 519 528 assume( h != NULL ); 520 521 #ifndef NDEBUG522 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));523 #else524 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));525 #endif526 529 527 530 if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD) … … 533 536 if( __DEBUG__ ) 534 537 { 535 PrintS("ComputeLeadingSyzygyTerms::Input: \n"); 536 537 const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0))); 538 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0))); 539 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0))); 540 541 542 Print("\nSYZCHECK: \t%d", __SYZCHECK__); 543 Print(", DEBUG: \t%d", __DEBUG__); 544 Print(", LEAD2SYZ: \t%d", __LEAD2SYZ__); 545 Print(", TAILREDSYZ: \t%d\n", __TAILREDSYZ__); 546 538 PrintS("ComputeLeadingSyzygyTerms::Input: \n"); 547 539 dPrint(id, r, r, 1); 548 549 assume( !__LEAD2SYZ__ );550 540 } 541 542 assume( !__LEAD2SYZ__ ); 551 543 552 544 h = h->Next(); assume (h == NULL); 553 545 554 const ideal newid = ComputeLeadingSyzygyTerms(id, r );546 const ideal newid = ComputeLeadingSyzygyTerms(id, r, attributes); 555 547 556 548 res->data = newid; res->rtyp = MODUL_CMD; … … 567 559 static BOOLEAN _Sort_c_ds(leftv res, leftv h) 568 560 { 561 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 562 563 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 564 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 565 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 566 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 567 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 568 569 569 NoReturn(res); 570 570 … … 579 579 580 580 assume( h != NULL ); 581 582 #ifndef NDEBUG583 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));584 #else585 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));586 #endif587 581 588 582 if( (h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD) … … 598 592 { 599 593 PrintS("Sort_c_ds::Input: \n"); 600 601 const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));602 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));603 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));604 605 Print("\nSYZCHECK: \t%d", __SYZCHECK__);606 Print(", DEBUG: \t%d", __DEBUG__);607 Print(", LEAD2SYZ: \t%d", __LEAD2SYZ__);608 Print(", TAILREDSYZ: \t%d\n", __TAILREDSYZ__);609 610 594 dPrint(id, r, r, 1); 611 595 } … … 637 621 static BOOLEAN _Compute2LeadingSyzygyTerms(leftv res, leftv h) 638 622 { 623 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 624 625 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 626 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 627 const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 628 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 629 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 630 639 631 const ring r = currRing; 640 632 NoReturn(res); … … 648 640 assume( h != NULL ); 649 641 650 #ifndef NDEBUG 651 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE))); 652 #else 653 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE))); 654 #endif 655 656 const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0))); 657 658 assume( __LEAD2SYZ__ ); 642 assume( __LEAD2SYZ__ ); // ??? 659 643 660 644 if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD) … … 672 656 h = h->Next(); assume (h == NULL); 673 657 674 res->data = Compute2LeadingSyzygyTerms(id, r );658 res->data = Compute2LeadingSyzygyTerms(id, r, attributes); 675 659 res->rtyp = MODUL_CMD; 676 660 … … 687 671 static BOOLEAN _FindReducer(leftv res, leftv h) 688 672 { 673 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 674 675 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 676 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 677 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 678 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 679 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 680 689 681 const char* usage = "`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected"; 690 682 const ring r = currRing; … … 692 684 NoReturn(res); 693 685 694 695 #ifndef NDEBUG696 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));697 #else698 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));699 #endif700 701 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));702 686 703 687 if ((h==NULL) || (h->Typ()!=VECTOR_CMD && h->Typ() !=POLY_CMD) || (h->Data() == NULL)) … … 766 750 767 751 res->rtyp = VECTOR_CMD; 768 res->data = FindReducer(product, syzterm, L, LS, r );752 res->data = FindReducer(product, syzterm, L, LS, r, attributes); 769 753 770 754 if( __DEBUG__ ) … … 781 765 static BOOLEAN _SchreyerSyzygyNF(leftv res, leftv h) 782 766 { 767 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 768 769 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 770 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 771 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 772 const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 773 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 774 783 775 const char* usage = "`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected"; 784 776 const ring r = currRing; … … 786 778 NoReturn(res); 787 779 788 #ifndef NDEBUG 789 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE))); 790 #else 791 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE))); 792 #endif 793 794 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0))); 795 // const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0))); 796 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0))); 797 798 const BOOLEAN __HYBRIDNF__ = (BOOLEAN)((long)(atGet(currRingHdl,"HYBRIDNF",INT_CMD, (void*)0))); 799 800 assume( __HYBRIDNF__ ); 780 assume( __HYBRIDNF__ ); // ??? 801 781 802 782 if ((h==NULL) || (h->Typ() != VECTOR_CMD) || (h->Data() == NULL)) … … 872 852 873 853 res->rtyp = VECTOR_CMD; 874 res->data = SchreyerSyzygyNF(syz_lead, syz_2, L, T, LS, r );854 res->data = SchreyerSyzygyNF(syz_lead, syz_2, L, T, LS, r, attributes); 875 855 876 856 if( __DEBUG__ ) … … 890 870 static BOOLEAN _ReduceTerm(leftv res, leftv h) 891 871 { 872 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 873 874 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 875 const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 876 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 877 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 878 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 879 892 880 const char* usage = "`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected"; 893 881 const ring r = currRing; 894 882 895 883 NoReturn(res); 896 897 #ifndef NDEBUG898 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));899 #else900 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));901 #endif902 903 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));904 // const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));905 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));906 884 907 885 if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL)) … … 1014 992 1015 993 res->rtyp = VECTOR_CMD; 1016 res->data = ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, r );994 res->data = ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, r, attributes); 1017 995 1018 996 … … 1034 1012 static BOOLEAN _TraverseTail(leftv res, leftv h) 1035 1013 { 1014 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 1015 1016 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 1017 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 1018 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 1019 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 1020 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 1021 1036 1022 const char* usage = "`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected"; 1037 1023 const ring r = currRing; 1038 1024 1039 1025 NoReturn(res); 1040 1041 #ifndef NDEBUG1042 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));1043 #else1044 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));1045 #endif1046 1047 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)1)));1048 1026 1049 1027 if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL)) … … 1121 1099 1122 1100 res->rtyp = VECTOR_CMD; 1123 res->data = TraverseTail(multiplier, tail, L, T, LS, r );1101 res->data = TraverseTail(multiplier, tail, L, T, LS, r, attributes); 1124 1102 1125 1103 … … 1139 1117 static BOOLEAN _ComputeSyzygy(leftv res, leftv h) 1140 1118 { 1119 const SchreyerSyzygyComputationFlags attributes(currRingHdl); 1120 1121 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 1122 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 1123 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 1124 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 1125 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 1126 1141 1127 const char* usage = "`ComputeSyzygy(<ideal/module>, <ideal/module>])` expected"; 1142 1128 const ring r = currRing; … … 1144 1130 NoReturn(res); 1145 1131 1146 #ifndef NDEBUG1147 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));1148 #else1149 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));1150 #endif1151 1152 1132 if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL)) 1153 1133 { … … 1183 1163 ideal LL, TT; 1184 1164 1185 ComputeSyzygy(L, T, LL, TT, r );1165 ComputeSyzygy(L, T, LL, TT, r, attributes); 1186 1166 1187 1167 lists l = (lists)omAllocBin(slists_bin); l->Init(2); -
dyn_modules/syzextra/singularxx_defs.h
r92992c r4eba3ad 23 23 #define SINGULAR_singular_defs_h_ 24 24 25 26 #ifdef HAVE_NAMESPACES 27 25 28 #define BEGIN_NAMESPACE(a) namespace a { 26 29 #define END_NAMESPACE } 30 27 31 #define USING_NAMESPACE(a) using namespace a; 32 #define FROM_NAMESPACE(a, s) a :: s 33 34 #else 35 36 #define BEGIN_NAMESPACE(a) 37 #define END_NAMESPACE 38 39 #define USING_NAMESPACE(a) 40 #define FROM_NAMESPACE(a, s) s 41 42 #endif 43 28 44 29 45 #define SINGULARXXNAME Singular … … 31 47 #define BEGIN_NAMESPACE_SINGULARXX BEGIN_NAMESPACE(SINGULARXXNAME) 32 48 #define END_NAMESPACE_SINGULARXX END_NAMESPACE 49 33 50 #define USING_NAMESPACE_SINGULARXX USING_NAMESPACE(SINGULARXXNAME) 34 35 #define FROM_NAMESPACE_SINGULARXXNAME(s) SINGULARXXNAME :: s 51 #define FROM_NAMESPACE_SINGULARXXNAME(s) FROM_NAMESPACE(SINGULARXXNAME, s) 36 52 37 53 #define BEGIN_NAMESPACE_NONAME BEGIN_NAMESPACE() -
dyn_modules/syzextra/syzextra.cc
r92992c r4eba3ad 92 92 //return -( compare (c, qsorts) ) 93 93 94 #ifndef NDEBUG 94 95 const int __DEBUG__ = 0; 95 96 #ifndef NDEBUG97 96 if( __DEBUG__ ) 98 97 { … … 216 215 217 216 if( sizeNew >= 2 ) 218 qsort_my(id->m, sizeNew, sizeof(poly), r, SORT_c_ds::cmp_c_ds);217 qsort_my(id->m, sizeNew, sizeof(poly), r, FROM_NAMESPACE(SORT_c_ds, cmp_c_ds)); 219 218 220 219 #undef qsort_my … … 226 225 BEGIN_NAMESPACE(INTERNAL) 227 226 228 ideal ComputeLeadingSyzygyTerms(const ideal& id, const ring r) 229 { 227 ideal _ComputeLeadingSyzygyTerms(const ideal& id, 228 const ring r, 229 const SchreyerSyzygyComputationFlags attributes) 230 { 231 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 232 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 233 const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 234 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 235 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 236 237 assume(!__LEAD2SYZ__); 238 230 239 // 1. set of components S? 231 240 // 2. for each component c from S: set of indices of leading terms … … 329 338 } 330 339 331 332 333 334 ideal Compute2LeadingSyzygyTerms(const ideal& id, const ring r) 335 { 336 #ifndef NDEBUG 337 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE))); 338 #else 339 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE))); 340 #endif 341 342 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0))); 343 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0))); 344 345 340 ideal _Compute2LeadingSyzygyTerms(const ideal& id, 341 const ring r, 342 const SchreyerSyzygyComputationFlags attributes) 343 { 344 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 345 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 346 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 347 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 348 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 349 346 350 347 351 // 1. set of components S? … … 482 486 } 483 487 484 poly FindReducer(poly product, poly syzterm, 485 ideal L, ideal LS, 486 const ring r) 487 { 488 poly _FindReducer(poly product, poly syzterm, 489 ideal L, ideal LS, 490 const ring r, 491 const SchreyerSyzygyComputationFlags attributes) 492 { 493 const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 494 const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 495 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 496 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 497 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 498 488 499 assume( product != NULL ); 489 500 assume( L != NULL ); … … 495 506 496 507 assume( c >= 0 && c < IDELEMS(L) ); 497 498 #ifndef NDEBUG499 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));500 #else501 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));502 #endif503 504 long debug = __DEBUG__;505 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)debug)));506 508 507 509 if (__SYZCHECK__ && syzterm != NULL) … … 542 544 if( __DEBUG__ ) 543 545 { 544 Print(" FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: ");546 Print("_FindReducer::Test SYZTERM: q == syzterm !:((, syzterm is: "); 545 547 dPrint(syzterm, r, r, 1); 546 548 } … … 564 566 if( __DEBUG__ ) 565 567 { 566 Print(" FindReducer::Test LS: q is divisible by LS[%d] !:((, diviser is: ", kk+1);568 Print("_FindReducer::Test LS: q is divisible by LS[%d] !:((, diviser is: ", kk+1); 567 569 dPrint(pp, r, r, 1); 568 570 } … … 589 591 } 590 592 591 poly TraverseTail(poly multiplier, poly tail, 592 ideal L, ideal T, ideal LS, 593 const ring r) 594 { 593 poly _ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 594 ideal L, ideal T, ideal LS, 595 const ring r, const SchreyerSyzygyComputationFlags attributes); 596 597 poly _TraverseTail(poly multiplier, poly tail, 598 ideal L, ideal T, ideal LS, 599 const ring r, 600 const SchreyerSyzygyComputationFlags attributes) 601 { 602 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 603 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 604 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 605 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 606 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 607 595 608 assume( multiplier != NULL ); 596 609 … … 602 615 // iterate over the tail 603 616 for(poly p = tail; p != NULL; p = pNext(p)) 604 s = p_Add_q(s, ReduceTerm(multiplier, p, NULL, L, T, LS, r), r);617 s = p_Add_q(s, _ReduceTerm(multiplier, p, NULL, L, T, LS, r, attributes), r); 605 618 606 619 return s; … … 608 621 609 622 610 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 611 ideal L, ideal T, ideal LS, const ring r) 612 { 623 poly _ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 624 ideal L, ideal T, ideal LS, 625 const ring r, 626 const SchreyerSyzygyComputationFlags attributes) 627 { 628 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 629 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 630 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 631 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 632 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 633 613 634 assume( multiplier != NULL ); 614 635 assume( term4reduction != NULL ); … … 627 648 // NOTE: only LT(term4reduction) should be used in the following: 628 649 poly product = pp_Mult_mm(multiplier, term4reduction, r); 629 s = FindReducer(product, syztermCheck, L, LS, r);650 s = _FindReducer(product, syztermCheck, L, LS, r, attributes); 630 651 p_Delete(&product, r); 631 652 } … … 642 663 643 664 if( tail != NULL ) 644 s = p_Add_q(s, TraverseTail(b, tail, L, T, LS, r), r);665 s = p_Add_q(s, _TraverseTail(b, tail, L, T, LS, r, attributes), r); 645 666 646 667 return s; … … 648 669 649 670 650 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, ideal L, ideal T, ideal LS, const ring r) 651 { 671 poly _SchreyerSyzygyNF(poly syz_lead, poly syz_2, 672 ideal L, ideal T, ideal LS, 673 const ring r, 674 const SchreyerSyzygyComputationFlags attributes) 675 { 676 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 677 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 678 // const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 679 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 680 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 681 652 682 assume( syz_lead != NULL ); 653 683 assume( syz_2 != NULL ); … … 678 708 while (spoly != NULL) 679 709 { 680 poly t = FindReducer(spoly, NULL, L, LS, r);710 poly t = _FindReducer(spoly, NULL, L, LS, r, attributes); 681 711 682 712 p_LmDelete(&spoly, r); … … 701 731 702 732 703 void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R) 704 { 733 void _ComputeSyzygy(const ideal L, const ideal T, 734 ideal& LL, ideal& TT, 735 const ring R, 736 const SchreyerSyzygyComputationFlags attributes) 737 { 738 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 739 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 740 const BOOLEAN __LEAD2SYZ__ = attributes.__LEAD2SYZ__; 741 const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 742 const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 743 705 744 assume( R == currRing ); // For attributes :-/ 706 745 707 746 assume( IDELEMS(L) == IDELEMS(T) ); 708 747 709 #ifndef NDEBUG710 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));711 #else712 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));713 #endif714 715 const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)1)));716 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)1)));717 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)__DEBUG__)));718 719 const BOOLEAN __HYBRIDNF__ = (BOOLEAN)((long)(atGet(currRingHdl,"HYBRIDNF",INT_CMD, (void*)0)));720 721 722 748 if( __LEAD2SYZ__ ) 723 LL = Compute2LeadingSyzygyTerms(L, R); // 2 terms!749 LL = _Compute2LeadingSyzygyTerms(L, R, attributes); // 2 terms! 724 750 else 725 LL = ComputeLeadingSyzygyTerms(L, R); // 1 term!751 LL = _ComputeLeadingSyzygyTerms(L, R, attributes); // 1 term! 726 752 727 753 const int size = IDELEMS(LL); … … 758 784 if( ! __HYBRIDNF__ ) 759 785 { 760 poly t = TraverseTail(aa, T->m[r], L, T, LS, R);786 poly t = _TraverseTail(aa, T->m[r], L, T, LS, R, attributes); 761 787 762 788 if( a2 != NULL ) … … 768 794 assume( r2 >= 0 && r2 < IDELEMS(T) ); 769 795 770 TT->m[k] = p_Add_q(a2, p_Add_q(t, TraverseTail(aa2, T->m[r2], L, T, LS, R), R), R);796 TT->m[k] = p_Add_q(a2, p_Add_q(t, _TraverseTail(aa2, T->m[r2], L, T, LS, R, attributes), R), R); 771 797 772 798 p_Delete(&aa2, R); 773 799 } else 774 TT->m[k] = p_Add_q(t, ReduceTerm(aa, L->m[r], a, L, T, LS, R), R);800 TT->m[k] = p_Add_q(t, _ReduceTerm(aa, L->m[r], a, L, T, LS, R, attributes), R); 775 801 776 802 } else … … 779 805 { 780 806 aa = p_Mult_mm(aa, L->m[r], R); 781 a2 = FindReducer(aa, a, L, LS, R);807 a2 = _FindReducer(aa, a, L, LS, R, attributes); 782 808 } 783 809 assume( a2 != NULL ); 784 810 785 TT->m[k] = SchreyerSyzygyNF(a, a2, L, T, LS, R); // will copy a2 :(811 TT->m[k] = _SchreyerSyzygyNF(a, a2, L, T, LS, R, attributes); // will copy a2 :( 786 812 787 813 p_Delete(&a2, R); … … 796 822 797 823 824 // TODO: wrapper layer, just for now... dissolve! 825 798 826 void SchreyerSyzygyComputation::ComputeSyzygy() 799 827 { 800 828 /// assumes m_syzLeads == m_syzTails == NULL! 801 INTERNAL::ComputeSyzygy(m_idLeads, m_idTails, m_syzLeads, m_syzTails, m_rBaseRing); // TODO: just a wrapper for now :/829 FROM_NAMESPACE(INTERNAL, _ComputeSyzygy(m_idLeads, m_idTails, m_syzLeads, m_syzTails, m_rBaseRing, m_atttributes)); // TODO: just a wrapper for now :/ 802 830 } 803 831 … … 805 833 { 806 834 if( bComputeSecondTerms ) 807 m_syzLeads = INTERNAL::Compute2LeadingSyzygyTerms(m_idLeads, m_rBaseRing);835 m_syzLeads = FROM_NAMESPACE(INTERNAL, _Compute2LeadingSyzygyTerms(m_idLeads, m_rBaseRing, m_atttributes)); 808 836 else 809 m_syzLeads = INTERNAL::ComputeLeadingSyzygyTerms(m_idLeads, m_rBaseRing);837 m_syzLeads = FROM_NAMESPACE(INTERNAL, _ComputeLeadingSyzygyTerms(m_idLeads, m_rBaseRing, m_atttributes)); 810 838 811 839 // NOTE: set m_LS if tails are to be reduced! 812 840 } 813 841 814 poly SchreyerSyzygyComputation::FindReducer(poly product, poly syzterm) 815 { 816 return INTERNAL::FindReducer(product, syzterm, m_idLeads, m_LS, m_rBaseRing); 817 } 818 819 poly SchreyerSyzygyComputation::SchreyerSyzygyNF(poly syz_lead, poly syz_2) 820 { 821 return INTERNAL::SchreyerSyzygyNF(syz_lead, syz_2, m_idLeads, m_idTails, m_LS, m_rBaseRing); 822 } 823 824 poly SchreyerSyzygyComputation::TraverseTail(poly multiplier, poly tail) 825 { 826 return INTERNAL::TraverseTail(multiplier, tail, m_idLeads, m_idTails, m_LS, m_rBaseRing); 827 } 828 829 poly SchreyerSyzygyComputation::ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) 830 { 831 return INTERNAL::ReduceTerm(multiplier, term4reduction, syztermCheck, m_idLeads, m_idTails, m_LS, m_rBaseRing); 832 } 833 842 poly SchreyerSyzygyComputation::FindReducer(poly product, poly syzterm) const 843 { 844 return FROM_NAMESPACE(INTERNAL, _FindReducer(product, syzterm, m_idLeads, m_LS, m_rBaseRing, m_atttributes)); 845 } 846 847 poly SchreyerSyzygyComputation::SchreyerSyzygyNF(poly syz_lead, poly syz_2) const 848 { 849 return FROM_NAMESPACE(INTERNAL, _SchreyerSyzygyNF(syz_lead, syz_2, m_idLeads, m_idTails, m_LS, m_rBaseRing, m_atttributes)); 850 } 851 852 poly SchreyerSyzygyComputation::TraverseTail(poly multiplier, poly tail) const 853 { 854 return FROM_NAMESPACE(INTERNAL, _TraverseTail(multiplier, tail, m_idLeads, m_idTails, m_LS, m_rBaseRing, m_atttributes)); 855 } 856 857 poly SchreyerSyzygyComputation::ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) const 858 { 859 return FROM_NAMESPACE(INTERNAL, _ReduceTerm(multiplier, term4reduction, syztermCheck, m_idLeads, m_idTails, m_LS, m_rBaseRing, m_atttributes)); 860 } 861 862 863 BEGIN_NAMESPACE_NONAME 834 864 865 static inline int atGetInt(idhdl rootRingHdl, const char* attribute, int def) 866 { 867 return ((int)(long)(atGet(rootRingHdl, attribute, INT_CMD, (void*)def))); 868 } 869 870 END_NAMESPACE 871 872 SchreyerSyzygyComputationFlags::SchreyerSyzygyComputationFlags(idhdl rootRingHdl): 873 #ifndef NDEBUG 874 __DEBUG__( (BOOLEAN)atGetInt(rootRingHdl,"DEBUG", TRUE) ), 875 #else 876 __DEBUG__( (BOOLEAN)atGetInt(rootRingHdl,"DEBUG", FALSE) ), 877 #endif 878 __SYZCHECK__( (BOOLEAN)atGetInt(rootRingHdl, "SYZCHECK", __DEBUG__) ), 879 __LEAD2SYZ__( (BOOLEAN)atGetInt(rootRingHdl, "LEAD2SYZ", 1) ), 880 __TAILREDSYZ__( (BOOLEAN)atGetInt(rootRingHdl, "TAILREDSYZ", 1) ), 881 __HYBRIDNF__( (BOOLEAN)atGetInt(rootRingHdl, "HYBRIDNF", 0) ) 882 { 883 if( __DEBUG__ ) 884 { 885 PrintS("SchreyerSyzygyComputationFlags: \n"); 886 Print(" DEBUG : \t%d\n", __DEBUG__); 887 Print(" SYZCHECK : \t%d\n", __SYZCHECK__); 888 Print(" LEAD2SYZ : \t%d\n", __LEAD2SYZ__); 889 Print(" TAILREDSYZ: \t%d\n", __TAILREDSYZ__); 890 } 891 892 // TODO: just current setting! 893 assume( rootRingHdl == currRingHdl ); 894 assume( rootRingHdl->typ == RING_CMD ); 895 assume( rootRingHdl->data.uring == currRing ); 896 // move the global ring here inside??? 897 } 898 899 835 900 836 901 -
dyn_modules/syzextra/syzextra.h
r92992c r4eba3ad 30 30 typedef struct sip_sideal * ideal; 31 31 32 class idrec; 33 typedef idrec * idhdl; 32 34 33 35 BEGIN_NAMESPACE_SINGULARXX BEGIN_NAMESPACE(SYZEXTRA) … … 51 53 52 54 55 56 57 58 /// Computation attribute storage 59 struct SchreyerSyzygyComputationFlags 60 { 61 SchreyerSyzygyComputationFlags(idhdl rootRingHdl); 62 63 /// output all the intermediate states 64 const bool __DEBUG__; // DebugOutput; 65 66 /// ? 67 const bool __SYZCHECK__; // CheckSyzygyProperty; 68 69 /// ? 70 const bool __LEAD2SYZ__; // TwoLeadingSyzygyTerms; 71 72 /// Reduce syzygy tails wrt the leading syzygy terms 73 const bool __TAILREDSYZ__; // TailReducedSyzygies; 74 75 /// Use the usual NF's S-poly reduction while dropping lower order terms 76 const bool __HYBRIDNF__; // UseHybridNF 77 78 }; 79 80 81 53 82 /** @class SchreyerSyzygyComputation syzextra.h 54 83 * … … 65 94 public: 66 95 /// Construct a global object for given input data (separated into leads & tails) 67 SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ring rBaseRing): 68 m_idLeads(idLeads), m_idTails(idTails), m_rBaseRing(rBaseRing), 69 m_syzLeads(NULL), m_syzTails(NULL), m_LS(NULL) {} 96 SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ring rBaseRing, const SchreyerSyzygyComputationFlags attribues): 97 m_rBaseRing(rBaseRing), 98 m_idLeads(idLeads), m_idTails(idTails), 99 m_syzLeads(NULL), m_syzTails(NULL), m_LS(NULL), m_atttributes(attribues) {} 70 100 71 101 72 102 /// Construct a global object for given input data (separated into leads & tails) 73 SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ideal syzLeads, const ring rBaseRing): 74 m_idLeads(idLeads), m_idTails(idTails), m_rBaseRing(rBaseRing), 75 m_syzLeads(NULL), m_syzTails(NULL), m_LS(syzLeads) {} 103 SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ideal syzLeads, const ring rBaseRing, const SchreyerSyzygyComputationFlags attribues): 104 m_rBaseRing(rBaseRing), 105 m_idLeads(idLeads), m_idTails(idTails), 106 m_syzLeads(NULL), m_syzTails(NULL), m_LS(syzLeads), m_atttributes(attribues) {} 76 107 77 108 … … 96 127 97 128 // TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz? 98 poly FindReducer(poly product, poly syzterm) ;99 100 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2) ;129 poly FindReducer(poly product, poly syzterm) const; 130 131 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2) const; 101 132 102 133 // TODO: store m * @tail -.-^-.-^-.--> ? 103 poly TraverseTail(poly multiplier, poly tail) ;134 poly TraverseTail(poly multiplier, poly tail) const; 104 135 105 136 // TODO: save shortcut (syz: |-.->) LM(m) * "t" -> ? 106 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck); 107 108 137 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) const; 138 109 139 protected: 110 140 … … 129 159 130 160 /*mutable?*/ ideal m_LS; ///< leading syzygy terms used for reducing syzygy tails 161 162 const SchreyerSyzygyComputationFlags m_atttributes; 131 163 }; 132 164 … … 134 166 // The following wrappers are just for testing separate functions on highest level (within schreyer.lib) 135 167 136 static inline void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R )137 { 138 SchreyerSyzygyComputation syz(L, T, R );168 static inline void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R, const SchreyerSyzygyComputationFlags A) 169 { 170 SchreyerSyzygyComputation syz(L, T, R, A); 139 171 syz.ComputeSyzygy(); 140 172 syz.ReadOffResult(LL, TT); 141 173 } 142 174 143 static inline ideal ComputeLeadingSyzygyTerms(const ideal& L, const ring R )144 { 145 SchreyerSyzygyComputation syz(L, NULL, R );175 static inline ideal ComputeLeadingSyzygyTerms(const ideal& L, const ring R, const SchreyerSyzygyComputationFlags A) 176 { 177 SchreyerSyzygyComputation syz(L, NULL, R, A); 146 178 syz.ComputeLeadingSyzygyTerms(false); 147 179 ideal LL, TT; … … 150 182 } 151 183 152 static inline ideal Compute2LeadingSyzygyTerms(const ideal& L, const ring R )153 { 154 SchreyerSyzygyComputation syz(L, NULL, R );184 static inline ideal Compute2LeadingSyzygyTerms(const ideal& L, const ring R, const SchreyerSyzygyComputationFlags A) 185 { 186 SchreyerSyzygyComputation syz(L, NULL, R, A); 155 187 syz.ComputeLeadingSyzygyTerms(true); 156 188 ideal LL, TT; … … 160 192 161 193 static inline poly FindReducer(poly product, poly syzterm, 162 ideal L, ideal LS, const ring R )163 { 164 SchreyerSyzygyComputation syz(L, NULL, LS, R );194 ideal L, ideal LS, const ring R, const SchreyerSyzygyComputationFlags A) 195 { 196 SchreyerSyzygyComputation syz(L, NULL, LS, R, A); 165 197 return syz.FindReducer(product, syzterm); 166 198 } 167 199 168 200 static inline poly TraverseTail(poly multiplier, poly tail, 169 ideal L, ideal T, ideal LS, const ring R )170 { 171 SchreyerSyzygyComputation syz(L, T, LS, R );201 ideal L, ideal T, ideal LS, const ring R, const SchreyerSyzygyComputationFlags A) 202 { 203 SchreyerSyzygyComputation syz(L, T, LS, R, A); 172 204 return syz.TraverseTail(multiplier, tail); 173 205 } 174 206 175 207 static inline poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 176 ideal L, ideal T, ideal LS, const ring R )177 { 178 SchreyerSyzygyComputation syz(L, T, LS, R );208 ideal L, ideal T, ideal LS, const ring R, const SchreyerSyzygyComputationFlags A) 209 { 210 SchreyerSyzygyComputation syz(L, T, LS, R, A); 179 211 return syz.ReduceTerm(multiplier, term4reduction, syztermCheck); 180 212 } … … 182 214 183 215 static inline poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, 184 ideal L, ideal T, ideal LS, const ring R )185 { 186 SchreyerSyzygyComputation syz(L, T, LS, R );216 ideal L, ideal T, ideal LS, const ring R, const SchreyerSyzygyComputationFlags A) 217 { 218 SchreyerSyzygyComputation syz(L, T, LS, R, A); 187 219 return syz.SchreyerSyzygyNF(syz_lead, syz_2); 188 220 } 189 190 191 221 192 222 END_NAMESPACE
Note: See TracChangeset
for help on using the changeset viewer.