My Project  debian-1:4.1.2-p1+ds-2
summator.h
Go to the documentation of this file.
1 #ifndef SUMMATOR_H
2 #define SUMMATOR_H
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 
7 #define HAVE_SUMMATOR 1
8 
9 #ifdef HAVE_SUMMATOR
10 #include "polys/monomials/ring.h"
11 #include "polys/sbuckets.h"
12 
13 // TODO: redesign into templates with no extra run-time cost!!!
14 // TODO: make several out of CPolynomialSummator with similar (?) usage
15 // pattern/interface!!!
16 
17 // //////////////////////////////////////////////////////////////////////// //
18 /// CPolynomialSummator: unifies bucket and polynomial summation as the
19 /// later is brocken in buckets :(
21 {
22  private:
23  const ring& m_basering;
24  const bool m_bUsePolynomial;
25  union
26  {
27  sBucket_pt m_bucket;
28 // kBucket_pt m_kbucket;
29  poly m_poly;
30  } m_temp;
31  public:
32  CPolynomialSummator(const ring& rBaseRing, bool bUsePolynomial = false);
33 // CPolynomialSummator(ring rBaseRing, poly pInitialSum, int iLength = 0, bool bUsePolynomial = false);
35 
36  // adds and destroes the summand
37  void AddAndDelete(poly pSummand, int iLength);
38  void AddAndDelete(poly pSummand);
39 
40  inline void operator +=(poly pSummand){ AddAndDelete(pSummand); }
41 
42  // only adds and keeps the summand
43  // please use AddAndDelete instead!
44  void Add(poly pSummand, int iLength);
45  void Add(poly pSummand);
46 
47  // get the final result and clear (set to zero) the summator
48  poly AddUpAndClear();
49  poly AddUpAndClear(int *piLength);
50 
51  inline operator poly() { return AddUpAndClear(); }
52 
53  /// Copy constructor
55  private:
56 
57  /// no assignment operator yet
59 };
60 
61 #endif // ifdef HAVE_SUMMATOR
62 #endif // ifndef SUMMATOR_H
63 
CPolynomialSummator::operator+=
void operator+=(poly pSummand)
Definition: summator.h:39
CPolynomialSummator::m_temp
union CPolynomialSummator::@5 m_temp
CPolynomialSummator::CPolynomialSummator
CPolynomialSummator(const ring &rBaseRing, bool bUsePolynomial=false)
Definition: summator.cc:32
CPolynomialSummator::AddUpAndClear
poly AddUpAndClear()
Definition: summator.cc:122
CPolynomialSummator::Add
void Add(poly pSummand, int iLength)
Definition: summator.cc:171
CPolynomialSummator::~CPolynomialSummator
~CPolynomialSummator()
Definition: summator.cc:69
sBucket
Definition: sbuckets.cc:27
ring.h
CPolynomialSummator::m_basering
const ring & m_basering
Definition: summator.h:22
CPolynomialSummator::operator=
CPolynomialSummator & operator=(const CPolynomialSummator &)
no assignment operator yet
CPolynomialSummator::m_bUsePolynomial
const bool m_bUsePolynomial
Definition: summator.h:23
CPolynomialSummator::AddAndDelete
void AddAndDelete(poly pSummand, int iLength)
Definition: summator.cc:98
sbuckets.h
CPolynomialSummator
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(.
Definition: summator.h:19