Changeset 7088f18 in git
- Timestamp:
- Jul 9, 2012, 9:34:12 PM (12 years ago)
- Branches:
- (u'spielwiese', '6e5adcba05493683b94648c659a729c189812c77')
- Children:
- 92992c08c2f387188f53d5f874a342fb60dccc06
- Parents:
- 20409220dfe91ce9647c6b8d12e43f086961aa14
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-09 21:34:12+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:45+02:00
- Location:
- dyn_modules/syzextra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
dyn_modules/syzextra/syzextra.cc
r204092 r7088f18 56 56 BEGIN_NAMESPACE_SINGULARXX BEGIN_NAMESPACE(SYZEXTRA) 57 57 58 58 59 BEGIN_NAMESPACE(SORT_c_ds) 59 60 … … 223 224 224 225 226 BEGIN_NAMESPACE(INTERNAL) 225 227 226 228 ideal ComputeLeadingSyzygyTerms(const ideal& id, const ring r) … … 791 793 } 792 794 793 794 795 796 797 795 END_NAMESPACE 796 797 798 void SchreyerSyzygyComputation::ComputeSyzygy() 799 { 800 /// 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 :/ 802 } 803 804 void SchreyerSyzygyComputation::ComputeLeadingSyzygyTerms(bool bComputeSecondTerms) 805 { 806 if( bComputeSecondTerms ) 807 m_syzLeads = INTERNAL::Compute2LeadingSyzygyTerms(m_idLeads, m_rBaseRing); 808 else 809 m_syzLeads = INTERNAL::ComputeLeadingSyzygyTerms(m_idLeads, m_rBaseRing); 810 811 // NOTE: set m_LS if tails are to be reduced! 812 } 813 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 834 798 835 799 836 -
dyn_modules/syzextra/syzextra.h
r204092 r7088f18 47 47 ideal id_Tail(const ideal id, const ring r); 48 48 49 50 49 /// inplace sorting of the module (ideal) id wrt >_(c,ds) 51 50 void Sort_c_ds(const ideal id, const ring r); 52 51 53 ideal ComputeLeadingSyzygyTerms(const ideal& id, const ring r);54 52 55 ideal Compute2LeadingSyzygyTerms(const ideal& id, const ring r); 53 /** @class SchreyerSyzygyComputation syzextra.h 54 * 55 * Computing syzygies after Schreyer 56 * 57 * Storing/accumulating data during the computation requires some global 58 * object, like this class. Ideally the above global functions should not 59 * be used in favour of this class. 60 * 61 * @sa Schreyer Syzygy Computation Paper & Talk & Python prototype 62 */ 63 class SchreyerSyzygyComputation 64 { 65 public: 66 /// 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) {} 56 70 57 71 58 poly FindReducer(poly product, poly syzterm, 59 ideal L, ideal LS, 60 const ring r); 72 /// 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) {} 76 77 78 /// Destructor should not destruct the resulting m_syzLeads, m_syzTails. 79 ~SchreyerSyzygyComputation(){ CleanUp(); } 80 81 /// Read off the results while detaching them from this object 82 /// NOTE: no copy! 83 inline void ReadOffResult(ideal& syzL, ideal& syzT) 84 { 85 syzL = m_syzLeads; syzT = m_syzTails; 86 87 m_syzLeads = m_syzTails = NULL; // m_LS ? 88 } 89 90 /// The main driver function: computes 91 void ComputeSyzygy(); 92 93 /// Computes Syz(leads) or only LEAD of it. 94 /// The result is stored into m_syzLeads 95 void ComputeLeadingSyzygyTerms(bool bComputeSecondTerms = true); 96 97 poly FindReducer(poly product, poly syzterm); 98 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2); 99 poly TraverseTail(poly multiplier, poly tail); 100 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck); 101 102 103 protected: 104 105 /// Clean up all the accumulated data 106 void CleanUp() {} 107 108 private: 109 /// global base ring 110 const ring m_rBaseRing; 111 112 /// input leading terms 113 const ideal m_idLeads; 114 115 /// input tails 116 const ideal m_idTails; 117 118 /// output (syzygy) leading terms (+2nd terms?) 119 ideal m_syzLeads; 120 121 /// output (syzygy) tails 122 ideal m_syzTails; 123 124 /*mutable?*/ ideal m_LS; ///< leading syzygy terms used for reducing syzygy tails 125 }; 61 126 62 127 63 poly TraverseTail(poly multiplier, poly tail, 64 ideal L, ideal T, ideal LS, 65 const ring r); 128 // The following wrappers are just for testing separate functions on highest level (within schreyer.lib) 66 129 67 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 68 ideal L, ideal T, ideal LS, const ring r); 130 static inline void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R) 131 { 132 SchreyerSyzygyComputation syz(L, T, R); 133 syz.ComputeSyzygy(); 134 syz.ReadOffResult(LL, TT); 135 } 136 137 static inline ideal ComputeLeadingSyzygyTerms(const ideal& L, const ring R) 138 { 139 SchreyerSyzygyComputation syz(L, NULL, R); 140 syz.ComputeLeadingSyzygyTerms(false); 141 ideal LL, TT; 142 syz.ReadOffResult(LL, TT); 143 return LL; // assume TT is NULL! 144 } 145 146 static inline ideal Compute2LeadingSyzygyTerms(const ideal& L, const ring R) 147 { 148 SchreyerSyzygyComputation syz(L, NULL, R); 149 syz.ComputeLeadingSyzygyTerms(true); 150 ideal LL, TT; 151 syz.ReadOffResult(LL, TT); 152 return LL; // assume TT is NULL! 153 } 154 155 static inline poly FindReducer(poly product, poly syzterm, 156 ideal L, ideal LS, const ring R) 157 { 158 SchreyerSyzygyComputation syz(L, NULL, LS, R); 159 return syz.FindReducer(product, syzterm); 160 } 161 162 static inline poly TraverseTail(poly multiplier, poly tail, 163 ideal L, ideal T, ideal LS, const ring R) 164 { 165 SchreyerSyzygyComputation syz(L, T, LS, R); 166 return syz.TraverseTail(multiplier, tail); 167 } 168 169 static inline poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, 170 ideal L, ideal T, ideal LS, const ring R) 171 { 172 SchreyerSyzygyComputation syz(L, T, LS, R); 173 return syz.ReduceTerm(multiplier, term4reduction, syztermCheck); 174 } 175 176 177 static inline poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, 178 ideal L, ideal T, ideal LS, const ring R) 179 { 180 SchreyerSyzygyComputation syz(L, T, LS, R); 181 return syz.SchreyerSyzygyNF(syz_lead, syz_2); 182 } 69 183 70 184 71 185 72 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, ideal L, ideal T, ideal LS, const ring r); 73 74 75 void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R); 76 77 78 END_NAMESPACE END_NAMESPACE_SINGULARXX 186 END_NAMESPACE 187 188 END_NAMESPACE_SINGULARXX 79 189 80 190 #endif
Note: See TracChangeset
for help on using the changeset viewer.