| 1 |
/** @file add.h |
/** @file add.h |
| 2 |
* |
* |
| 3 |
* Interface to GiNaC's sums of expressions. |
* Interface to GiNaC's sums of expressions. */ |
| 4 |
* |
|
| 5 |
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany |
/* |
| 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 |
* 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 |
* it under the terms of the GNU General Public License as published by |
| 23 |
#ifndef __GINAC_ADD_H__ |
#ifndef __GINAC_ADD_H__ |
| 24 |
#define __GINAC_ADD_H__ |
#define __GINAC_ADD_H__ |
| 25 |
|
|
| 26 |
|
#include "expairseq.h" |
| 27 |
|
|
| 28 |
|
#ifndef NO_NAMESPACE_GINAC |
| 29 |
|
namespace GiNaC { |
| 30 |
|
#endif // ndef NO_NAMESPACE_GINAC |
| 31 |
|
|
| 32 |
/** Sum of expressions. */ |
/** Sum of expressions. */ |
| 33 |
class add : public expairseq |
class add : public expairseq |
| 34 |
{ |
{ |
| 35 |
|
GINAC_DECLARE_REGISTERED_CLASS(add, expairseq) |
| 36 |
|
|
| 37 |
friend class mul; |
friend class mul; |
| 38 |
friend class ncmul; |
friend class ncmul; |
| 39 |
friend class power; |
friend class power; |
| 44 |
public: |
public: |
| 45 |
add(); |
add(); |
| 46 |
~add(); |
~add(); |
| 47 |
add(add const & other); |
add(const add & other); |
| 48 |
add const & operator=(add const & other); |
const add & operator=(const add & other); |
| 49 |
protected: |
protected: |
| 50 |
void copy(add const & other); |
void copy(const add & other); |
| 51 |
void destroy(bool call_parent); |
void destroy(bool call_parent); |
| 52 |
|
|
| 53 |
// other constructors |
// other constructors |
| 54 |
public: |
public: |
| 55 |
add(ex const & lh, ex const & rh); |
add(const ex & lh, const ex & rh); |
| 56 |
add(exvector const & v); |
add(const exvector & v); |
| 57 |
add(epvector const & v); |
add(const epvector & v); |
| 58 |
//add(epvector const & v, bool do_not_canonicalize=0); |
//add(const epvector & v, bool do_not_canonicalize=0); |
| 59 |
add(epvector const & v, ex const & oc); |
add(const epvector & v, const ex & oc); |
| 60 |
add(epvector * vp, ex const & oc); |
add(epvector * vp, const ex & oc); |
| 61 |
|
|
| 62 |
// functions overriding virtual functions from bases classes |
// functions overriding virtual functions from bases classes |
| 63 |
public: |
public: |
| 64 |
basic * duplicate() const; |
basic * duplicate() const; |
|
void printraw(ostream & os) const; |
|
| 65 |
void print(ostream & os, unsigned upper_precedence=0) const; |
void print(ostream & os, unsigned upper_precedence=0) const; |
| 66 |
|
void printraw(ostream & os) const; |
| 67 |
void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; |
void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const; |
| 68 |
bool info(unsigned inf) const; |
bool info(unsigned inf) const; |
| 69 |
int degree(symbol const & s) const; |
int degree(const symbol & s) const; |
| 70 |
int ldegree(symbol const & s) const; |
int ldegree(const symbol & s) const; |
| 71 |
ex coeff(symbol const & s, int const n=1) const; |
ex coeff(const symbol & s, int n=1) const; |
| 72 |
ex eval(int level=0) const; |
ex eval(int level=0) const; |
| 73 |
ex diff(symbol const & s) const; |
ex diff(const symbol & s) const; |
| 74 |
ex series(symbol const & s, ex const & point, int order) const; |
ex series(const symbol & s, const ex & point, int order) const; |
| 75 |
ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; |
ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; |
| 76 |
numeric integer_content(void) const; |
numeric integer_content(void) const; |
| 77 |
ex smod(numeric const &xi) const; |
ex smod(const numeric &xi) const; |
| 78 |
numeric max_coefficient(void) const; |
numeric max_coefficient(void) const; |
| 79 |
exvector get_indices(void) const; |
exvector get_indices(void) const; |
| 80 |
ex simplify_ncmul(exvector const & v) const; |
ex simplify_ncmul(const exvector & v) const; |
| 81 |
protected: |
protected: |
| 82 |
int compare_same_type(basic const & other) const; |
int compare_same_type(const basic & other) const; |
| 83 |
bool is_equal_same_type(basic const & other) const; |
bool is_equal_same_type(const basic & other) const; |
| 84 |
unsigned return_type(void) const; |
unsigned return_type(void) const; |
| 85 |
unsigned return_type_tinfo(void) const; |
unsigned return_type_tinfo(void) const; |
| 86 |
ex thisexpairseq(epvector const & v, ex const & oc) const; |
ex thisexpairseq(const epvector & v, const ex & oc) const; |
| 87 |
ex thisexpairseq(epvector * vp, ex const & oc) const; |
ex thisexpairseq(epvector * vp, const ex & oc) const; |
| 88 |
void printpair(ostream & os, expair const & p, |
expair split_ex_to_pair(const ex & e) const; |
| 89 |
unsigned upper_precedence) const; |
expair combine_ex_with_coeff_to_pair(const ex & e, |
| 90 |
expair split_ex_to_pair(ex const & e) const; |
const ex & c) const; |
| 91 |
expair combine_ex_with_coeff_to_pair(ex const & e, |
expair combine_pair_with_coeff_to_pair(const expair & p, |
| 92 |
ex const & c) const; |
const ex & c) const; |
| 93 |
expair combine_pair_with_coeff_to_pair(expair const & p, |
ex recombine_pair_to_ex(const expair & p) const; |
|
ex const & c) const; |
|
|
ex recombine_pair_to_ex(expair const & p) const; |
|
| 94 |
ex expand(unsigned options=0) const; |
ex expand(unsigned options=0) const; |
| 95 |
|
|
| 96 |
// new virtual functions which can be overridden by derived classes |
// new virtual functions which can be overridden by derived classes |
| 108 |
// global constants |
// global constants |
| 109 |
|
|
| 110 |
extern const add some_add; |
extern const add some_add; |
| 111 |
extern type_info const & typeid_add; |
extern const type_info & typeid_add; |
| 112 |
|
|
| 113 |
#define ex_to_add(X) static_cast<add const &>(*(X).bp) |
// utility functions |
| 114 |
|
inline const add &ex_to_add(const ex &e) |
| 115 |
|
{ |
| 116 |
|
return static_cast<const add &>(*e.bp); |
| 117 |
|
} |
| 118 |
|
|
| 119 |
#endif // ndef __GINAC_ADD_H__ |
#ifndef NO_NAMESPACE_GINAC |
| 120 |
|
} // namespace GiNaC |
| 121 |
|
#endif // ndef NO_NAMESPACE_GINAC |
| 122 |
|
|
| 123 |
|
#endif // ndef __GINAC_ADD_H__ |