Changeset dd24e5 in git
- Timestamp:
- Aug 1, 2012, 5:25:00 PM (12 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 495328d14a955b215ad10b598e995ab522243881
- Parents:
- 026171e1f09fe373a5c6ea5ed0b8db1abeb952f3
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-08-01 17:25:00+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:46+02:00
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/schreyer.lib
r026171 rdd24e5 2349 2349 2350 2350 2351 proc testSimple() 2352 { 2351 proc testSimple(list #) 2352 { 2353 def DEBUG = 0; 2354 if(size(#) > 0) { DEBUG = #[1]; } 2355 2353 2356 system("--min-time", "1.0"); 2354 2357 system("--ticks-per-sec", 1); 2355 2358 2356 2359 // TODO: only for now!! 2357 attrib(SSinit, "DEBUG", 0);2360 attrib(SSinit, "DEBUG", (DEBUG > 0)); 2358 2361 attrib(SSinit, "SYZCHECK", 1); 2359 2362 attrib(SSinit, "KERCHECK", 1); … … 2471 2474 TestSSresAttribs2tr(M); 2472 2475 /* 2473 options: 1 1 0 : Time: 10 (35 without LCM)2474 options: 1 1 1 : Time: 252475 lres Time: 5 /62476 options: 1 1 0 : Time: 9/10 (35 without LCM) 2477 options: 1 1 1 : Time: 8/25 2478 lres Time: 5 2476 2479 nres Time: 5 2477 2480 sres Time: 693 … … 2550 2553 TestSSresAttribs2tr(M); 2551 2554 /* 2552 options: 1 1 0 : Time: 92 (316 without LCM)2553 options: 1 1 1 : Time: 2022554 lres Time: 2 7/282555 nres Time: 2 1/232555 options: 1 1 0 : Time: 73/92 (316 without LCM) 2556 options: 1 1 1 : Time: 43/202 2557 lres Time: 25 2558 nres Time: 20 2556 2559 sres Time: 71 2557 2560 */ -
dyn_modules/syzextra/syzextra.cc
r026171 rdd24e5 251 251 } 252 252 253 254 253 // TODO/NOTE: input is supposed to be (reverse-) sorted wrt "(c,ds)"!?? 255 254 … … 489 488 } 490 489 490 491 CReducerFinder::CLeadingTerm::CLeadingTerm(unsigned int _label, const poly _lt, const ring R): 492 m_sev( p_GetShortExpVector(_lt, R) ), m_label( _label ), m_lt( _lt ) 493 { } 494 495 496 CReducerFinder::~CReducerFinder() 497 { 498 for( CReducersHash::const_iterator it = m_hash.begin(); it != m_hash.end(); it++ ) 499 { 500 const TReducers& v = it->second; 501 for(TReducers::const_iterator vit = v.begin(); vit != v.end(); vit++ ) 502 delete const_cast<CLeadingTerm*>(*vit); 503 } 504 } 505 506 CReducerFinder::CReducerFinder(const SchreyerSyzygyComputation& data): m_data(data), m_hash() 507 { 508 509 const ideal& L = data.m_idLeads; 510 const ring& R = data.m_rBaseRing; 511 // const SchreyerSyzygyComputationFlags& attributes = data.m_atttributes; 512 // 513 // const BOOLEAN __DEBUG__ = attributes.__DEBUG__; 514 // const BOOLEAN __SYZCHECK__ = attributes.__SYZCHECK__; 515 // const BOOLEAN __HYBRIDNF__ = attributes.__HYBRIDNF__; 516 // const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__; 517 518 519 assume( L != NULL ); 520 assume( R != NULL ); 521 assume( R == currRing ); 522 523 for( int k = IDELEMS(L) - 1; k >= 0; k-- ) 524 { 525 const poly a = L->m[k]; assume( a != NULL ); 526 527 // NOTE: label is k \in 0 ... |L|-1!!! 528 m_hash[p_GetComp(a, R)].push_back( new CLeadingTerm(k, a, R) ); 529 } 530 } 531 532 491 533 CLCM::CLCM(const SchreyerSyzygyComputation& data): std::vector<bool>(), m_data(data), m_compute(false) 492 534 { … … 606 648 poly a2 = pNext(a); 607 649 650 // Splitting 2-terms Leading syzygy module 608 651 if( a2 != NULL ) 609 652 { … … 633 676 if( a2 == NULL ) 634 677 { 635 aa = p_Mult_mm(aa, L->m[r], R); 636 a2 = FindReducer(aa, a); 678 aa = p_Mult_mm(aa, L->m[r], R); a2 = m_div.FindReducer(aa, a); 637 679 } 638 680 assume( a2 != NULL ); … … 677 719 } 678 720 679 poly SchreyerSyzygyComputation::FindReducer(poly product,poly syzterm) const721 poly CReducerFinder::FindReducer(const poly product, const poly syzterm) const 680 722 { 681 723 // return FROM_NAMESPACE(INTERNAL, _FindReducer(product, syzterm, m_idLeads, m_LS, m_rBaseRing, m_atttributes)); … … 685 727 // const SchreyerSyzygyComputationFlags attributes) 686 728 687 const ideal& L = m_ idLeads;688 const ideal& LS = m_ LS;689 const ring& r = m_ rBaseRing;690 const SchreyerSyzygyComputationFlags& attributes = m_ atttributes;729 const ideal& L = m_data.m_idLeads; 730 const ideal& LS = m_data.m_LS; 731 const ring& r = m_data.m_rBaseRing; 732 const SchreyerSyzygyComputationFlags& attributes = m_data.m_atttributes; 691 733 692 734 … … 700 742 assume( L != NULL ); 701 743 702 intc = 0;744 long c = 0; 703 745 704 746 if (syzterm != NULL) … … 706 748 707 749 assume( c >= 0 && c < IDELEMS(L) ); 708 709 if (__ SYZCHECK__ && syzterm != NULL)750 751 if (__DEBUG__ && (syzterm != NULL)) 710 752 { 711 753 const poly m = L->m[c]; … … 722 764 } 723 765 724 // looking for an appropriate diviser q = L[k]... 725 for( int k = IDELEMS(L)-1; k>= 0; k-- ) 726 { 727 const poly p = L->m[k]; 728 729 // ... which divides the product, looking for the _1st_ appropriate one! 730 if( !p_LmDivisibleBy(p, product, r) ) 731 continue; 766 const long comp = p_GetComp(product, r); 767 const unsigned long not_sev = ~p_GetShortExpVector(product, r); 768 769 assume( comp >= 0 ); 770 771 // looking for an appropriate diviser p = L[k]... 772 #if 1 773 CReducersHash::const_iterator it = m_hash.find(p_GetComp(product, r)); // same module component 774 775 if( it == m_hash.end() ) 776 return NULL; 777 778 const TReducers& reducers = it->second; 779 780 for(TReducers::const_iterator vit = reducers.begin(); vit != reducers.end(); vit++ ) 781 { 782 const poly p = (*vit)->m_lt; 783 784 assume( p_GetComp(p, r) == comp ); 785 786 const int k = (*vit)->m_label; 787 788 assume( L->m[k] == p ); 789 790 const unsigned long p_sev = (*vit)->m_sev; 791 792 assume( p_sev == p_GetShortExpVector(p, r) ); 793 #else 794 for( int k = IDELEMS(L)-1; k>= 0; k-- ) 795 { 796 const poly p = L->m[k]; 797 798 if ( p_GetComp(p, r) != comp ) 799 continue; 800 801 const unsigned long p_sev = p_GetShortExpVector(p, r); // to be stored in m_hash!!! 802 #endif 803 804 if( !p_LmShortDivisibleByNoComp(p, p_sev, product, not_sev, r) ) 805 continue; 806 807 // // ... which divides the product, looking for the _1st_ appropriate one! 808 // if( !p_LmDivisibleByNoComp(p, product, r) ) // included inside p_LmShortDivisibleBy! 809 // continue; 732 810 733 811 … … 758 836 BOOLEAN ok = TRUE; 759 837 838 // TODO: FindReducer in LS !!! there should be no divisors! 760 839 for(int kk = IDELEMS(LS)-1; kk>= 0; kk-- ) 761 840 { … … 842 921 while (spoly != NULL) 843 922 { 844 poly t = FindReducer(spoly, NULL);923 poly t = m_div.FindReducer(spoly, NULL); 845 924 846 925 p_LmDelete(&spoly, r); … … 942 1021 // NOTE: only LT(term4reduction) should be used in the following: 943 1022 poly product = pp_Mult_mm(multiplier, term4reduction, r); 944 s = FindReducer(product, syztermCheck);1023 s = m_div.FindReducer(product, syztermCheck); 945 1024 p_Delete(&product, r); 946 1025 } -
dyn_modules/syzextra/syzextra.h
r026171 rdd24e5 18 18 19 19 #include <vector> 20 #include <map> 20 21 21 22 // include basic definitions … … 96 97 97 98 99 class CReducerFinder 100 { 101 private: 102 class CLeadingTerm 103 { 104 public: 105 CLeadingTerm(unsigned int id, const poly p, const ring); 106 107 private: 108 CLeadingTerm(); 109 110 public: 111 112 const unsigned long m_sev; ///< not short exp. vector 113 // NOTE/TODO: either of the following should be enough: 114 const unsigned int m_label; ///< index in the main L[] + 1 115 const poly m_lt; ///< the leading term itself L[label-1] 116 }; 117 118 typedef long TComponentKey; 119 typedef std::vector<const CLeadingTerm*> TReducers; 120 typedef std::map< TComponentKey, TReducers> CReducersHash; 121 122 public: 123 124 /// goes over all leading terms 125 CReducerFinder(const SchreyerSyzygyComputation& data); 126 127 ~CReducerFinder(); 128 129 // TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz? 130 poly FindReducer(const poly product, const poly syzterm) const; 131 132 private: 133 const SchreyerSyzygyComputation& m_data; 134 135 CReducersHash m_hash; // can also be replaced with a vector indexed by components 136 }; 137 138 139 98 140 /** @class SchreyerSyzygyComputation syzextra.h 99 141 * … … 109 151 { 110 152 friend class CLCM; 153 friend class CReducerFinder; 111 154 112 155 public: … … 117 160 m_idLeads(idLeads), m_idTails(idTails), 118 161 m_syzLeads(NULL), m_syzTails(NULL), m_LS(NULL), m_atttributes(attribues), 119 m_lcm(*this) 162 m_lcm(*this), m_div(*this) 120 163 { 121 164 } … … 127 170 m_idLeads(idLeads), m_idTails(idTails), 128 171 m_syzLeads(NULL), m_syzTails(NULL), m_LS(syzLeads), m_atttributes(attribues), 129 m_lcm(*this) 172 m_lcm(*this), m_div(*this) 130 173 { 131 174 } … … 151 194 void ComputeLeadingSyzygyTerms(bool bComputeSecondTerms = true); 152 195 153 // TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz?154 poly FindReducer(poly product, poly syzterm) const;155 156 196 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2) const; 157 197 … … 162 202 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) const; 163 203 204 public: 205 /// just for testing via the wrapper below 206 inline poly _FindReducer(const poly product, const poly syzterm) const 207 { return m_div.FindReducer(product, syzterm); } 208 164 209 protected: 165 210 … … 195 240 /// Bitmask for variables occuring in leading terms 196 241 const CLCM m_lcm; 242 243 /// Divisor finder 244 const CReducerFinder m_div; 197 245 }; 198 246 … … 229 277 { 230 278 SchreyerSyzygyComputation syz(L, NULL, LS, R, A); 231 return syz. FindReducer(product, syzterm);279 return syz._FindReducer(product, syzterm); 232 280 } 233 281
Note: See TracChangeset
for help on using the changeset viewer.