]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
1d9507117b3fe907740c433da1bb28bfb83f82b8
[ginac.git] / ginac / mul.h
1 /** @file mul.h
2  *
3  *  Interface to GiNaC's products of expressions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __GINAC_MUL_H__
24 #define __GINAC_MUL_H__
25
26 #include <ginac/expairseq.h>
27
28 #ifndef NO_GINAC_NAMESPACE
29 namespace GiNaC {
30 #endif // ndef NO_GINAC_NAMESPACE
31
32 /** Product of expressions. */
33 class mul : public expairseq
34 {
35     friend class add;
36     friend class ncmul;
37     friend class power;
38
39 // member functions
40
41     // default constructor, destructor, copy constructor assignment operator and helpers
42 public:
43     mul();
44     ~mul();
45     mul(mul const & other);
46     mul const & operator=(mul const & other);
47 protected:
48     void copy(mul const & other);
49     void destroy(bool call_parent);
50
51     // other constructors
52 public:
53     mul(ex const & lh, ex const & rh);
54     mul(exvector const & v);
55     mul(epvector const & v);
56     //mul(epvector const & v, bool do_not_canonicalize=0);
57     mul(epvector const & v, ex const & oc);
58     mul(epvector * vp, ex const & oc);
59     mul(ex const & lh, ex const & mh, ex const & rh);
60
61     // functions overriding virtual functions from bases classes
62 public:
63     basic * duplicate() const;
64     void print(ostream & os, unsigned upper_precedence) const;
65     void printraw(ostream & os) const;
66     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
67     bool info(unsigned inf) const;
68     int degree(symbol const & s) const;
69     int ldegree(symbol const & s) const;
70     ex coeff(symbol const & s, int const n=1) const;
71     ex eval(int level=0) const;
72     ex diff(symbol const & s) const;
73     ex series(symbol const & s, ex const & point, int order) const;
74     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
75     numeric integer_content(void) const;
76     ex smod(const numeric &xi) const;
77     numeric max_coefficient(void) const;
78     exvector get_indices(void) const;
79     ex simplify_ncmul(exvector const & v) const;
80 protected:
81     int compare_same_type(basic const & other) const;
82     bool is_equal_same_type(basic const & other) const;
83     unsigned return_type(void) const;
84     unsigned return_type_tinfo(void) const;
85     ex thisexpairseq(epvector const & v, ex const & oc) const;
86     ex thisexpairseq(epvector * vp, ex const & oc) const;
87     expair split_ex_to_pair(ex const & e) const;
88     expair combine_ex_with_coeff_to_pair(ex const & e,
89                                          ex const & c) const;
90     expair combine_pair_with_coeff_to_pair(expair const & p,
91                                            ex const & c) const;
92     ex recombine_pair_to_ex(expair const & p) const;
93     bool expair_needs_further_processing(epp it);
94     ex default_overall_coeff(void) const;
95     void combine_overall_coeff(ex const & c);
96     void combine_overall_coeff(ex const & c1, ex const & c2);
97     bool can_make_flat(expair const & p) const;
98     ex expand(unsigned options=0) const;
99     
100     // new virtual functions which can be overridden by derived classes
101     // none
102
103     // non-virtual functions in this class
104 protected:
105     epvector * expandchildren(unsigned options) const;
106
107 // member variables
108
109 protected:
110     static unsigned precedence;
111 };
112
113 // global constants
114
115 extern const mul some_mul;
116 extern type_info const & typeid_mul;
117
118 // utility functions
119 inline const mul &ex_to_mul(const ex &e)
120 {
121         return static_cast<const mul &>(*e.bp);
122 }
123
124 #ifndef NO_GINAC_NAMESPACE
125 } // namespace GiNaC
126 #endif // ndef NO_GINAC_NAMESPACE
127
128 #endif // ndef __GINAC_MUL_H__