Changeset 9d0c2b in git
- Timestamp:
- Jul 8, 2008, 10:18:27 AM (15 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 77987005e6c432b32a83558af620b8a21ecaa8cc
- Parents:
- 9d249b2bd6e53779def56a0139a8157d70ec75c1
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile.in
r9d249b r9d0c2b 113 113 prCopy.cc p_Mult_q.cc \ 114 114 pDebug.cc pInline2.cc pInline1.cc pInline0.cc \ 115 pShallowCopyDelete.cc fast_mult.cc digitech.cc \115 pShallowCopyDelete.cc fast_mult.cc digitech.cc summator.cc\ 116 116 tgb.cc tgbgauss.cc ringgb.cc f5gb.cc ratgring.cc shiftgb.cc 117 117 … … 167 167 eigenval.h units.h mod_raw.h kbuckets.h sbuckets.h\ 168 168 mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \ 169 fegetopt.h distrib.h \169 fegetopt.h distrib.h summator.h\ 170 170 ratgring.h shiftgb.h prCopy.h prCopyMacros.h \ 171 171 p_MemAdd.h p_MemCopy.h p_MemCmp.h p_Numbers.h \ -
kernel/summator.cc
r9d249b r9d0c2b 6 6 * Purpose: simple Summator usecase implementation 7 7 * Author: motsak 8 * Created: 9 * Version: $Id: summator.cc,v 1. 1 2008-07-04 14:19:38 motsakExp $8 * Created: 9 * Version: $Id: summator.cc,v 1.2 2008-07-08 08:18:27 Singular Exp $ 10 10 *******************************************************************/ 11 11 … … 20 20 21 21 #include "mod2.h" 22 22 #ifdef HAVE_PLURAL 23 23 #include <summator.h> // for CPolynomialSummator class 24 24 #include <ring.h> … … 41 41 m_temp.m_bucket = sBucketCreate(rBaseRing); 42 42 } 43 } ;43 } 44 44 45 45 /* … … 50 50 #ifdef PDEBUG 51 51 p_Test(pInitialSum, rBaseRing); 52 #endif 52 #endif 53 53 54 54 if(bUsePolynomial) … … 76 76 #ifdef PDEBUG 77 77 p_Test(m_temp.m_poly, m_basering); 78 #endif 79 78 #endif 80 79 p_Delete(&m_temp.m_poly, m_basering); 81 80 // m_temp.m_poly = NULL; … … 87 86 #ifdef PDEBUG 88 87 p_Test(pSummand, m_basering); 89 #endif 90 88 #endif 89 91 90 if(m_bUsePolynomial) 92 91 m_temp.m_poly = p_Add_q(m_temp.m_poly, pSummand, m_basering); … … 99 98 #ifdef PDEBUG 100 99 p_Test(pSummand, m_basering); 101 #endif 100 #endif 102 101 103 102 if(m_bUsePolynomial) … … 110 109 { 111 110 poly out = NULL; 112 111 113 112 if(m_bUsePolynomial) 114 113 { 115 114 out = m_temp.m_poly; 116 115 m_temp.m_poly = NULL; 117 } else 116 } 117 else 118 118 { 119 119 int pLength; … … 123 123 #ifdef PDEBUG 124 124 p_Test(out, m_basering); 125 #endif 126 125 #endif 126 127 127 return out; 128 128 } … … 132 132 { 133 133 poly out = NULL; 134 134 135 135 if(m_bUsePolynomial) 136 136 { … … 138 138 m_temp.m_poly = NULL; 139 139 *piLength = pLength(out); 140 } else 140 } 141 else 141 142 { 142 143 *piLength = 0; … … 147 148 p_Test(out, m_basering); 148 149 assume(pLength(out) == *piLength); 149 #endif 150 150 #endif 151 151 152 return out; 152 153 } … … 157 158 { 158 159 AddAndDelete(p_Copy(pSummand, m_basering), iLength); 159 } ;160 } 160 161 161 162 void CPolynomialSummator::Add(poly pSummand) 162 163 { 163 164 AddAndDelete(p_Copy(pSummand, m_basering)); 164 } ;165 } 165 166 166 167 #endif -
kernel/summator.h
r9d249b r9d0c2b 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: summator.h,v 1. 1 2008-07-04 14:19:38 motsakExp $ */6 /* $Id: summator.h,v 1.2 2008-07-08 08:18:27 Singular Exp $ */ 7 7 8 8 // #include <summator.h> // for CPolynomialSummator class … … 15 15 // CPolynomialSummator: unifies bucket and polynomial summation as the 16 16 // later is brocken in buckets :( 17 17 #ifdef HAVE_PLURAL 18 18 class CPolynomialSummator 19 19 { … … 21 21 ring m_basering; 22 22 bool m_bUsePolynomial; 23 union { 23 union 24 { 24 25 sBucket_pt m_bucket; 25 26 poly m_poly; 26 } m_temp; 27 } m_temp; 27 28 public: 28 29 CPolynomialSummator(ring rBaseRing, bool bUsePolynomial = false); … … 33 34 void AddAndDelete(poly pSummand, int iLength); 34 35 void AddAndDelete(poly pSummand); 35 36 36 37 inline void operator +=(poly pSummand){ AddAndDelete(pSummand); } 37 38 … … 40 41 void Add(poly pSummand, int iLength); 41 42 void Add(poly pSummand); 42 43 43 44 // get the final result and clear (set to zero) the summator 44 45 poly AddUpAndClear(); … … 46 47 47 48 inline operator poly() { return AddUpAndClear(); } 48 49 49 50 private: // no copies of this object at the moment!!! 50 51 CPolynomialSummator(const CPolynomialSummator& m); // Copy constructor 51 CPolynomialSummator& operator= (const CPolynomialSummator& m); // Assignment operator 52 CPolynomialSummator& operator= (const CPolynomialSummator& m); // Assignment operator 52 53 }; 53 54 55 #endif 54 56 #endif // ifndef SUMMATOR_H 55 57 56 57 58 59 60
Note: See TracChangeset
for help on using the changeset viewer.