source: git/kernel/summator.h @ bc669c

fieker-DuValspielwiese
Last change on this file since bc669c was 341696, checked in by Hans Schönemann <hannes@…>, 15 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.6 KB
Line 
1#ifndef SUMMATOR_H
2#define SUMMATOR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
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    /// Copy constructor
51    CPolynomialSummator(const CPolynomialSummator&);
52
53  private:
54
55    /// no assignment operator yet
56    CPolynomialSummator& operator= (const CPolynomialSummator&);
57};
58
59#endif
60#endif // ifndef  SUMMATOR_H
61
Note: See TracBrowser for help on using the repository browser.