Changeset fb8b1cf in git for kernel/ncSAMult.h
- Timestamp:
- Jul 10, 2008, 5:07:46 PM (16 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 1367162082700b6bd218bdf7c3bacb10d1f624ca
- Parents:
- e675a91b1fd1b28f733dcb506498d7adfd7c1d1b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/ncSAMult.h
re675a91 rfb8b1cf 4 4 * Computer Algebra System SINGULAR * 5 5 *****************************************/ 6 /* $Id: ncSAMult.h,v 1. 1 2008-07-04 16:18:42motsak Exp $ */6 /* $Id: ncSAMult.h,v 1.2 2008-07-10 15:07:46 motsak Exp $ */ 7 7 #ifdef HAVE_PLURAL 8 8 … … 11 11 #include <structs.h> 12 12 #include <ring.h> 13 #include <summator.h> // for CPolynomialSummator class 13 14 14 15 // //////////////////////////////////////////////////////////////////////// // 15 16 // 17 template <typename CExponent> 18 class CMultiplier 19 { 20 protected: 21 ring m_basering; 22 23 enum EHistoryType { 24 MULT_START 25 } 26 27 public: 28 CMultiplier(ring rBaseRing): m_basering(rBaseRing) {}; 29 30 protected: 31 virtual CExponent GetExponent(const poly pMonom); // ugly! 32 33 virtual poly Multiply(const CExponent a, const CExponent b) = 0; 34 35 inline poly MultiplyMonoms(const poly pPoly, const CExponent b) 36 { return( p_Mult_nn(Multiply(GetExponent(pPoly), b), p_GetCoeff(pPoly,m_basering), m_basering); } 37 38 inline poly MultiplyMonoms(const CExponent a, const poly pPoly) 39 { return( p_Mult_nn(Multiply(a, GetExponent(pPoly)), p_GetCoeff(pPoly,m_basering), m_basering); } 40 41 42 poly Multiply(const poly pPoly, const CExponent b) 43 { 44 bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET); 45 CPolynomialSummator sum(m_basering, bUsePolynomial); 46 47 for( poly q = pPoly; q !=NULL; q = pNext(q) ) 48 sum += MultiplyMonoms(q, b); 49 50 return sum; 51 }; 52 53 poly Multiply(CExponent a, const poly pPoly) 54 { 55 bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET); 56 CPolynomialSummator sum(m_basering, bUsePolynomial); 57 58 for( poly q = pPoly; q !=NULL; q = pNext(q) ) 59 sum += MultiplyMonoms(a, q); 60 61 return sum; 62 }; 63 64 poly MultiplyAndDestroyPoly(poly pPoly, const CExponent b) 65 { 66 bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET); 67 CPolynomialSummator sum(m_basering, bUsePolynomial); 68 69 70 for( ; pPoly!=NULL; pPoly = p_LmDeleteAndNext(pPoly, m_basering) ) 71 sum += MultiplyMonoms(pPoly, b); 72 73 return sum; 74 }; 75 76 poly MultiplyAndDestroyPoly(CExponent a, poly pPoly) 77 { 78 bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (pLength(pPoly) < MIN_LENGTH_BUCKET); 79 CPolynomialSummator sum(m_basering, bUsePolynomial); 80 81 for( ; pPoly!=NULL; pPoly = p_LmDeleteAndNext(pPoly, m_basering) ) 82 sum += MultiplyMonoms(a, pPoly); 83 84 return sum; 85 }; 86 87 88 void History(CExponent a, CExponent b, EHistoryType t) 89 { 90 Print("Mult!\n"); 91 } 92 private: // no copy constuctors! 93 CMultiplier(); 94 operator =(CMultiplier&); 95 }; 96 97 typedef CMultiplier<int> CSpecialPairMultiplier; 98 typedef CMultiplier<int*> CGlobalMultiplier; 99 100 101 16 102 /* 17 103 … … 42 128 43 129 44 template <typename CExponent>45 class CMultiplier46 {47 public:48 virtual poly Multiply(CExponent a, CExponent b);49 protected:50 poly Multiply(poly p, CExponent b);51 poly Multiply(CExponent a, poly p);52 void History(CExponent a, CExponent b);53 private: // no copy constuctors!54 CMultiplier();55 operator =(CMultiplier&);56 }57 58 typedef CMultiplier<int> CSpecialPairMultiplier;59 typedef CMultiplier<int*> CGlobalMultiplier;60 61 62 130 class CCommutativeSpecialPairMultiplier: public CSpecialPairMultiplier 63 131 {
Note: See TracChangeset
for help on using the changeset viewer.