]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
bug fixed in an incomplete assertion in power.cpp
[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-2000 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 "expairseq.h"
27
28 #ifndef NO_NAMESPACE_GINAC
29 namespace GiNaC {
30 #endif // ndef NO_NAMESPACE_GINAC
31
32 /** Product of expressions. */
33 class mul : public expairseq
34 {
35     GINAC_DECLARE_REGISTERED_CLASS(mul, expairseq)
36
37     friend class add;
38     friend class ncmul;
39     friend class power;
40
41 // member functions
42
43     // default constructor, destructor, copy constructor assignment operator and helpers
44 public:
45     mul();
46     ~mul();
47     mul(const mul & other);
48     const mul & operator=(const mul & other);
49 protected:
50     void copy(const mul & other);
51     void destroy(bool call_parent);
52
53     // other constructors
54 public:
55     mul(const ex & lh, const ex & rh);
56     mul(const exvector & v);
57     mul(const epvector & v);
58     //mul(const epvector & v, bool do_not_canonicalize=0);
59     mul(const epvector & v, const ex & oc);
60     mul(epvector * vp, const ex & oc);
61     mul(const ex & lh, const ex & mh, const ex & rh);
62
63     // functions overriding virtual functions from bases classes
64 public:
65     basic * duplicate() const;
66     void print(ostream & os, unsigned upper_precedence) const;
67     void printraw(ostream & os) const;
68     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
69     bool info(unsigned inf) const;
70     int degree(const symbol & s) const;
71     int ldegree(const symbol & s) const;
72     ex coeff(const symbol & s, int n=1) const;
73     ex eval(int level=0) const;
74     ex evalf(int level=0) const;
75     ex series(const relational & s, int order) const;
76     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
77     numeric integer_content(void) const;
78     ex smod(const numeric &xi) const;
79     numeric max_coefficient(void) const;
80     exvector get_indices(void) const;
81     ex simplify_ncmul(const exvector & v) const;
82 protected:
83     ex derivative(const symbol & s) const;
84     int compare_same_type(const basic & other) const;
85     bool is_equal_same_type(const basic & other) const;
86     unsigned return_type(void) const;
87     unsigned return_type_tinfo(void) const;
88     ex thisexpairseq(const epvector & v, const ex & oc) const;
89     ex thisexpairseq(epvector * vp, const ex & oc) const;
90     expair split_ex_to_pair(const ex & e) const;
91     expair combine_ex_with_coeff_to_pair(const ex & e,
92                                          const ex & c) const;
93     expair combine_pair_with_coeff_to_pair(const expair & p,
94                                            const ex & c) const;
95     ex recombine_pair_to_ex(const expair & p) const;
96     bool expair_needs_further_processing(epp it);
97     ex default_overall_coeff(void) const;
98     void combine_overall_coeff(const ex & c);
99     void combine_overall_coeff(const ex & c1, const ex & c2);
100     bool can_make_flat(const expair & p) const;
101     ex expand(unsigned options=0) const;
102     
103     // new virtual functions which can be overridden by derived classes
104     // none
105
106     // non-virtual functions in this class
107 protected:
108     epvector * expandchildren(unsigned options) const;
109
110 // member variables
111
112 protected:
113     static unsigned precedence;
114 };
115
116 // global constants
117
118 extern const mul some_mul;
119 extern const type_info & typeid_mul;
120
121 // utility functions
122 inline const mul &ex_to_mul(const ex &e)
123 {
124         return static_cast<const mul &>(*e.bp);
125 }
126
127 #ifndef NO_NAMESPACE_GINAC
128 } // namespace GiNaC
129 #endif // ndef NO_NAMESPACE_GINAC
130
131 #endif // ndef __GINAC_MUL_H__