| 1 |
cbauer |
1.1 |
/** @file add.h
|
| 2 |
|
|
*
|
| 3 |
cbauer |
1.4 |
* Interface to GiNaC's sums of expressions. */
|
| 4 |
|
|
|
| 5 |
|
|
/*
|
| 6 |
vollinga |
1.47 |
* GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
|
| 7 |
cbauer |
1.2 |
*
|
| 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 |
kreckel |
1.46 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 21 |
cbauer |
1.2 |
*/
|
| 22 |
cbauer |
1.1 |
|
| 23 |
cbauer |
1.2 |
#ifndef __GINAC_ADD_H__
|
| 24 |
|
|
#define __GINAC_ADD_H__
|
| 25 |
cbauer |
1.1 |
|
| 26 |
cbauer |
1.13 |
#include "expairseq.h"
|
| 27 |
cbauer |
1.3 |
|
| 28 |
cbauer |
1.5 |
namespace GiNaC {
|
| 29 |
|
|
|
| 30 |
cbauer |
1.1 |
/** Sum of expressions. */
|
| 31 |
|
|
class add : public expairseq
|
| 32 |
|
|
{
|
| 33 |
cbauer |
1.19 |
GINAC_DECLARE_REGISTERED_CLASS(add, expairseq)
|
| 34 |
kreckel |
1.25 |
|
| 35 |
cbauer |
1.19 |
friend class mul;
|
| 36 |
|
|
friend class power;
|
| 37 |
kreckel |
1.25 |
|
| 38 |
cbauer |
1.19 |
// other constructors
|
| 39 |
cbauer |
1.1 |
public:
|
| 40 |
cbauer |
1.19 |
add(const ex & lh, const ex & rh);
|
| 41 |
|
|
add(const exvector & v);
|
| 42 |
|
|
add(const epvector & v);
|
| 43 |
|
|
add(const epvector & v, const ex & oc);
|
| 44 |
cbauer |
1.42 |
add(std::auto_ptr<epvector> vp, const ex & oc);
|
| 45 |
kreckel |
1.25 |
|
| 46 |
cbauer |
1.33 |
// functions overriding virtual functions from base classes
|
| 47 |
cbauer |
1.1 |
public:
|
| 48 |
cbauer |
1.38 |
unsigned precedence() const {return 40;}
|
| 49 |
cbauer |
1.19 |
bool info(unsigned inf) const;
|
| 50 |
cbauer |
1.27 |
int degree(const ex & s) const;
|
| 51 |
|
|
int ldegree(const ex & s) const;
|
| 52 |
|
|
ex coeff(const ex & s, int n=1) const;
|
| 53 |
cbauer |
1.19 |
ex eval(int level=0) const;
|
| 54 |
cbauer |
1.38 |
ex evalm() const;
|
| 55 |
cbauer |
1.19 |
ex series(const relational & r, int order, unsigned options = 0) const;
|
| 56 |
cbauer |
1.40 |
ex normal(exmap & repl, exmap & rev_lookup, int level=0) const;
|
| 57 |
cbauer |
1.38 |
numeric integer_content() const;
|
| 58 |
cbauer |
1.19 |
ex smod(const numeric &xi) const;
|
| 59 |
cbauer |
1.38 |
numeric max_coefficient() const;
|
| 60 |
cbauer |
1.44 |
ex conjugate() const;
|
| 61 |
chrisd |
1.49 |
ex real_part() const;
|
| 62 |
|
|
ex imag_part() const;
|
| 63 |
cbauer |
1.38 |
exvector get_free_indices() const;
|
| 64 |
|
|
ex eval_ncmul(const exvector & v) const;
|
| 65 |
cbauer |
1.1 |
protected:
|
| 66 |
cbauer |
1.19 |
ex derivative(const symbol & s) const;
|
| 67 |
cbauer |
1.38 |
unsigned return_type() const;
|
| 68 |
chrisd |
1.48 |
tinfo_t return_type_tinfo() const;
|
| 69 |
cbauer |
1.19 |
ex thisexpairseq(const epvector & v, const ex & oc) const;
|
| 70 |
cbauer |
1.42 |
ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc) const;
|
| 71 |
cbauer |
1.19 |
expair split_ex_to_pair(const ex & e) const;
|
| 72 |
|
|
expair combine_ex_with_coeff_to_pair(const ex & e,
|
| 73 |
kreckel |
1.25 |
const ex & c) const;
|
| 74 |
cbauer |
1.19 |
expair combine_pair_with_coeff_to_pair(const expair & p,
|
| 75 |
kreckel |
1.25 |
const ex & c) const;
|
| 76 |
cbauer |
1.19 |
ex recombine_pair_to_ex(const expair & p) const;
|
| 77 |
|
|
ex expand(unsigned options=0) const;
|
| 78 |
cbauer |
1.41 |
|
| 79 |
|
|
// non-virtual functions in this class
|
| 80 |
|
|
protected:
|
| 81 |
|
|
void print_add(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const;
|
| 82 |
|
|
void do_print(const print_context & c, unsigned level) const;
|
| 83 |
|
|
void do_print_latex(const print_latex & c, unsigned level) const;
|
| 84 |
|
|
void do_print_csrc(const print_csrc & c, unsigned level) const;
|
| 85 |
|
|
void do_print_python_repr(const print_python_repr & c, unsigned level) const;
|
| 86 |
cbauer |
1.1 |
};
|
| 87 |
|
|
|
| 88 |
cbauer |
1.5 |
} // namespace GiNaC
|
| 89 |
cbauer |
1.1 |
|
| 90 |
cbauer |
1.2 |
#endif // ndef __GINAC_ADD_H__
|