]> www.ginac.de Git - ginac.git/blob - ginac/add.h
6986b1e3ca039056b204a2e7df0105b5b14732e6
[ginac.git] / ginac / add.h
1 /** @file add.h
2  *
3  *  Interface to GiNaC's sums of expressions. */
4
5 #ifndef _ADD_H_
6 #define _ADD_H_
7
8 #include "expairseq.h"
9
10 /** Sum of expressions. */
11 class add : public expairseq
12 {
13     friend class mul;
14     friend class ncmul;
15     friend class power;
16
17 // member functions
18
19     // default constructor, destructor, copy constructor assignment operator and helpers
20 public:
21     add();
22     ~add();
23     add(add const & other);
24     add const & operator=(add const & other);
25 protected:
26     void copy(add const & other);
27     void destroy(bool call_parent);
28
29     // other constructors
30 public:
31     add(ex const & lh, ex const & rh);
32     add(exvector const & v);
33     add(epvector const & v);
34     //add(epvector const & v, bool do_not_canonicalize=0);
35     add(epvector const & v, ex const & oc);
36     add(epvector * vp, ex const & oc);
37
38     // functions overriding virtual functions from bases classes
39 public:
40     basic * duplicate() const;
41     void printraw(ostream & os) const;
42     void print(ostream & os, unsigned upper_precedence=0) const;
43     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
44     bool info(unsigned inf) const;
45     int degree(symbol const & s) const;
46     int ldegree(symbol const & s) const;
47     ex coeff(symbol const & s, int const n=1) const;
48     ex eval(int level=0) const;
49     ex diff(symbol const & s) const;
50     ex series(symbol const & s, ex const & point, int order) const;
51     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
52     numeric integer_content(void) const;
53     ex smod(numeric const &xi) const;
54     numeric max_coefficient(void) const;
55     exvector get_indices(void) const;
56     ex simplify_ncmul(exvector const & v) const;
57 protected:
58     int compare_same_type(basic const & other) const;
59     bool is_equal_same_type(basic const & other) const;
60     unsigned return_type(void) const;
61     unsigned return_type_tinfo(void) const;
62     ex thisexpairseq(epvector const & v, ex const & oc) const;
63     ex thisexpairseq(epvector * vp, ex const & oc) const;
64     void printpair(ostream & os, expair const & p,
65                    unsigned upper_precedence) const;
66     expair split_ex_to_pair(ex const & e) const;
67     expair combine_ex_with_coeff_to_pair(ex const & e,
68                                          ex const & c) const;
69     expair combine_pair_with_coeff_to_pair(expair const & p,
70                                            ex const & c) const;
71     ex recombine_pair_to_ex(expair const & p) const;
72     ex expand(unsigned options=0) const;
73     
74     // new virtual functions which can be overridden by derived classes
75     // none
76     
77     // non-virtual functions in this class
78     // none
79
80 // member variables
81
82 protected:
83     static unsigned precedence;
84 };
85
86 // global constants
87
88 extern const add some_add;
89 extern type_info const & typeid_add;
90
91 #define ex_to_add(X) static_cast<add const &>(*(X).bp)
92
93 #endif // ndef _ADD_H_
94