source: git/kernel/summator.h @ 2f2bb21

spielwiese
Last change on this file since 2f2bb21 was 9d0c2b, checked in by Hans Schönemann <hannes@…>, 16 years ago
*hannes: syntax git-svn-id: file:///usr/local/Singular/svn/trunk@10843 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1#ifndef SUMMATOR_H
2#define SUMMATOR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: summator.h,v 1.2 2008-07-08 08:18:27 Singular Exp $ */
7
8// #include <summator.h> // for CPolynomialSummator class
9
10#include <structs.h>
11// #include <p_polys.h> // due to p_Copy :(
12
13
14// //////////////////////////////////////////////////////////////////////// //
15// CPolynomialSummator: unifies bucket and polynomial summation as the
16// later is brocken in buckets :(
17#ifdef HAVE_PLURAL
18class CPolynomialSummator
19{
20  private:
21    ring m_basering;
22    bool m_bUsePolynomial;
23    union
24    {
25      sBucket_pt m_bucket;
26      poly       m_poly;
27    } m_temp;
28  public:
29    CPolynomialSummator(ring rBaseRing, bool bUsePolynomial = false);
30//    CPolynomialSummator(ring rBaseRing, poly pInitialSum, int iLength = 0, bool bUsePolynomial = false);
31    ~CPolynomialSummator();
32
33    // adds and destroes the summand
34    void AddAndDelete(poly pSummand, int iLength);
35    void AddAndDelete(poly pSummand);
36
37    inline void operator +=(poly pSummand){ AddAndDelete(pSummand); }
38
39    // only adds and keeps the summand
40    // please use AddAndDelete instead!
41    void Add(poly pSummand, int iLength);
42    void Add(poly pSummand);
43
44    // get the final result and clear (set to zero) the summator
45    poly AddUpAndClear();
46    poly AddUpAndClear(int *piLength);
47
48    inline operator poly() { return AddUpAndClear(); }
49
50  private: // no copies of this object at the moment!!!
51    CPolynomialSummator(const CPolynomialSummator& m);               // Copy constructor
52    CPolynomialSummator& operator= (const CPolynomialSummator& m);   // Assignment operator
53};
54
55#endif
56#endif // ifndef  SUMMATOR_H
57
Note: See TracBrowser for help on using the repository browser.