]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
the destructor, copy constructor, and assignment operator (which were the
[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-2001 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         // other constructors
42 public:
43         mul(const ex & lh, const ex & rh);
44         mul(const exvector & v);
45         mul(const epvector & v);
46         mul(const epvector & v, const ex & oc);
47         mul(epvector * vp, const ex & oc);
48         mul(const ex & lh, const ex & mh, const ex & rh);
49
50         // functions overriding virtual functions from bases classes
51 public:
52         basic * duplicate() const;
53         void print(std::ostream & os, unsigned upper_precedence) const;
54         void printraw(std::ostream & os) const;
55         void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const;
56         bool info(unsigned inf) const;
57         int degree(const symbol & s) const;
58         int ldegree(const symbol & s) const;
59         ex coeff(const symbol & s, int n = 1) const;
60         ex eval(int level=0) const;
61         ex evalf(int level=0) const;
62         ex series(const relational & s, int order, unsigned options = 0) const;
63         ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
64         numeric integer_content(void) const;
65         ex smod(const numeric &xi) const;
66         numeric max_coefficient(void) const;
67         exvector get_indices(void) const;
68         ex simplify_ncmul(const exvector & v) const;
69 protected:
70         ex derivative(const symbol & s) const;
71         int compare_same_type(const basic & other) const;
72         bool is_equal_same_type(const basic & other) const;
73         unsigned return_type(void) const;
74         unsigned return_type_tinfo(void) const;
75         ex thisexpairseq(const epvector & v, const ex & oc) const;
76         ex thisexpairseq(epvector * vp, const ex & oc) const;
77         expair split_ex_to_pair(const ex & e) const;
78         expair combine_ex_with_coeff_to_pair(const ex & e,
79                                                                                  const ex & c) const;
80         expair combine_pair_with_coeff_to_pair(const expair & p,
81                                                                                    const ex & c) const;
82         ex recombine_pair_to_ex(const expair & p) const;
83         bool expair_needs_further_processing(epp it);
84         ex default_overall_coeff(void) const;
85         void combine_overall_coeff(const ex & c);
86         void combine_overall_coeff(const ex & c1, const ex & c2);
87         bool can_make_flat(const expair & p) const;
88         ex expand(unsigned options=0) const;
89         
90         // new virtual functions which can be overridden by derived classes
91         // none
92
93         // non-virtual functions in this class
94 protected:
95         epvector * expandchildren(unsigned options) const;
96
97 // member variables
98
99 protected:
100         static unsigned precedence;
101 };
102
103 // utility functions
104 inline const mul &ex_to_mul(const ex &e)
105 {
106         return static_cast<const mul &>(*e.bp);
107 }
108
109 #ifndef NO_NAMESPACE_GINAC
110 } // namespace GiNaC
111 #endif // ndef NO_NAMESPACE_GINAC
112
113 #endif // ndef __GINAC_MUL_H__