]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
- fix LaTeX-output bug reported by Stefan, remove obsolete has(matrix,ex).
[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 namespace GiNaC {
29
30 /** Product of expressions. */
31 class mul : public expairseq
32 {
33         GINAC_DECLARE_REGISTERED_CLASS(mul, expairseq)
34         
35         friend class add;
36         friend class ncmul;
37         friend class power;
38         
39         // other ctors
40 public:
41         mul(const ex & lh, const ex & rh);
42         mul(const exvector & v);
43         mul(const epvector & v);
44         mul(const epvector & v, const ex & oc);
45         mul(epvector * vp, const ex & oc);
46         mul(const ex & lh, const ex & mh, const ex & rh);
47         
48         // functions overriding virtual functions from bases classes
49 public:
50         void print(const print_context & c, unsigned level = 0) const;
51         unsigned precedence(void) const {return 50;}
52         bool info(unsigned inf) const;
53         int degree(const ex & s) const;
54         int ldegree(const ex & s) const;
55         ex coeff(const ex & s, int n = 1) const;
56         ex eval(int level=0) const;
57         ex evalf(int level=0) const;
58         ex series(const relational & s, int order, unsigned options = 0) const;
59         ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const;
60         numeric integer_content(void) const;
61         ex smod(const numeric &xi) const;
62         numeric max_coefficient(void) const;
63         exvector get_free_indices(void) const;
64         ex simplify_ncmul(const exvector & v) const;
65 protected:
66         ex derivative(const symbol & s) const;
67         bool is_equal_same_type(const basic & other) const;
68         unsigned return_type(void) const;
69         unsigned return_type_tinfo(void) const;
70         ex thisexpairseq(const epvector & v, const ex & oc) const;
71         ex thisexpairseq(epvector * vp, const ex & oc) const;
72         expair split_ex_to_pair(const ex & e) const;
73         expair combine_ex_with_coeff_to_pair(const ex & e, const ex & c) const;
74         expair combine_pair_with_coeff_to_pair(const expair & p, const ex & c) const;
75         ex recombine_pair_to_ex(const expair & p) const;
76         bool expair_needs_further_processing(epp it);
77         ex default_overall_coeff(void) const;
78         void combine_overall_coeff(const ex & c);
79         void combine_overall_coeff(const ex & c1, const ex & c2);
80         bool can_make_flat(const expair & p) const;
81         ex expand(unsigned options=0) const;
82         
83         // new virtual functions which can be overridden by derived classes
84         // none
85         
86         // non-virtual functions in this class
87 protected:
88         epvector * expandchildren(unsigned options) const;
89 };
90
91 // utility functions
92 inline const mul &ex_to_mul(const ex &e)
93 {
94         return static_cast<const mul &>(*e.bp);
95 }
96
97 } // namespace GiNaC
98
99 #endif // ndef __GINAC_MUL_H__