GiNaC  1.8.0
add.h
Go to the documentation of this file.
1 
5 /*
6  * GiNaC Copyright (C) 1999-2020 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef GINAC_ADD_H
24 #define GINAC_ADD_H
25 
26 #include "expairseq.h"
27 
28 namespace GiNaC {
29 
31 class add : public expairseq
32 {
34 
35  friend class mul;
36  friend class power;
37 
38  // other constructors
39 public:
40  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  add(epvector && v);
45  add(epvector && v, const ex & oc);
46 
47  // functions overriding virtual functions from base classes
48 public:
49  unsigned precedence() const override {return 40;}
50  bool info(unsigned inf) const override;
51  bool is_polynomial(const ex & var) const override;
52  int degree(const ex & s) const override;
53  int ldegree(const ex & s) const override;
54  ex coeff(const ex & s, int n=1) const override;
55  ex eval() const override;
56  ex evalm() const override;
57  ex series(const relational & r, int order, unsigned options = 0) const override;
58  ex normal(exmap & repl, exmap & rev_lookup, lst & modifier) const override;
59  numeric integer_content() const override;
60  ex smod(const numeric &xi) const override;
61  numeric max_coefficient() const override;
62  ex conjugate() const override;
63  ex real_part() const override;
64  ex imag_part() const override;
65  exvector get_free_indices() const override;
66  ex eval_ncmul(const exvector & v) const override;
67 protected:
68  ex derivative(const symbol & s) const override;
69  unsigned return_type() const override;
70  return_type_t return_type_tinfo() const override;
71  ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const override;
72  ex thisexpairseq(epvector && vp, const ex & oc, bool do_index_renaming = false) const override;
73  expair split_ex_to_pair(const ex & e) const override;
75  const ex & c) const override;
77  const ex & c) const override;
78  ex recombine_pair_to_ex(const expair & p) const override;
79  ex expand(unsigned options=0) const override;
80 
81  // non-virtual functions in this class
82 protected:
83  void print_add(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const;
84  void do_print(const print_context & c, unsigned level) const;
85  void do_print_latex(const print_latex & c, unsigned level) const;
86  void do_print_csrc(const print_csrc & c, unsigned level) const;
87  void do_print_python_repr(const print_python_repr & c, unsigned level) const;
88 };
90 
91 } // namespace GiNaC
92 
93 #endif // ndef GINAC_ADD_H
GiNaC::print_python_repr
Context for python-parsable output.
Definition: print.h:139
GiNaC::epvector
std::vector< expair > epvector
expair-vector
Definition: expairseq.h:33
GiNaC::add::max_coefficient
numeric max_coefficient() const override
Implementation ex::max_coefficient().
Definition: normal.cpp:1171
GiNaC::add::info
bool info(unsigned inf) const override
Information about the object.
Definition: add.cpp:223
GiNaC::add::get_free_indices
exvector get_free_indices() const override
Return a vector containing the free indices of an expression.
Definition: indexed.cpp:464
GiNaC::add::combine_pair_with_coeff_to_pair
expair combine_pair_with_coeff_to_pair(const expair &p, const ex &c) const override
Definition: add.cpp:550
r
size_t r
Definition: factor.cpp:770
GiNaC::relational
This class holds a relation consisting of two expressions and a logical relation between them.
Definition: relational.h:35
GiNaC::print_context
Base class for print_contexts.
Definition: print.h:103
GiNaC::print_csrc
Base context for C source output.
Definition: print.h:158
GiNaC::add::evalm
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
Definition: add.cpp:362
GiNaC::exvector
std::vector< ex > exvector
Definition: basic.h:46
GiNaC::power
This class holds a two-component object, a basis and and exponent representing exponentiation.
Definition: power.h:39
GiNaC::add::do_print_python_repr
void do_print_python_repr(const print_python_repr &c, unsigned level) const
Definition: add.cpp:212
options
unsigned options
Definition: factor.cpp:2480
GiNaC::GINAC_DECLARE_UNARCHIVER
GINAC_DECLARE_UNARCHIVER(add)
GiNaC::add::is_polynomial
bool is_polynomial(const ex &var) const override
Check whether this is a polynomial in the given variables.
Definition: add.cpp:254
GiNaC::add
Sum of expressions.
Definition: add.h:32
GiNaC::add::eval_ncmul
ex eval_ncmul(const exvector &v) const override
Definition: add.cpp:450
GiNaC
Definition: add.cpp:38
GiNaC::add::print_add
void print_add(const print_context &c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const
Definition: add.cpp:115
GiNaC::add::degree
int degree(const ex &s) const override
Return degree of highest power in object s.
Definition: add.cpp:264
GiNaC::add::normal
ex normal(exmap &repl, exmap &rev_lookup, lst &modifier) const override
Implementation of ex::normal() for a sum.
Definition: normal.cpp:2306
GINAC_DECLARE_REGISTERED_CLASS
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153
GiNaC::ex
Lightweight wrapper for GiNaC's symbolic objects.
Definition: ex.h:72
GiNaC::add::series
ex series(const relational &r, int order, unsigned options=0) const override
Implementation of ex::series() for sums.
Definition: pseries.cpp:750
GiNaC::add::coeff
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in object s.
Definition: add.cpp:294
GiNaC::print_latex
Context for latex-parsable output.
Definition: print.h:123
GiNaC::add::recombine_pair_to_ex
ex recombine_pair_to_ex(const expair &p) const override
Definition: add.cpp:564
GiNaC::add::thisexpairseq
ex thisexpairseq(const epvector &v, const ex &oc, bool do_index_renaming=false) const override
Definition: add.cpp:498
GiNaC::return_type_t
To distinguish between different kinds of non-commutative objects.
Definition: registrar.h:44
GiNaC::add::smod
ex smod(const numeric &xi) const override
Apply symmetric modular homomorphism to an expanded multivariate polynomial.
Definition: normal.cpp:1213
GiNaC::add::combine_ex_with_coeff_to_pair
expair combine_ex_with_coeff_to_pair(const ex &e, const ex &c) const override
Definition: add.cpp:524
GiNaC::add::do_print_csrc
void do_print_csrc(const print_csrc &c, unsigned level) const
Definition: add.cpp:170
GiNaC::container
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
c
size_t c
Definition: factor.cpp:770
GiNaC::exmap
std::map< ex, ex, ex_is_less > exmap
Definition: basic.h:50
GiNaC::symbol
Basic CAS symbol.
Definition: symbol.h:39
expairseq.h
Interface to sequences of expression pairs.
GiNaC::add::precedence
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition: add.h:49
n
size_t n
Definition: factor.cpp:1463
GiNaC::add::ldegree
int ldegree(const ex &s) const override
Return degree of lowest power in object s.
Definition: add.cpp:279
GiNaC::add::integer_content
numeric integer_content() const override
Definition: normal.cpp:333
GiNaC::add::derivative
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a sum.
Definition: add.cpp:462
GiNaC::add::return_type_tinfo
return_type_t return_type_tinfo() const override
Definition: add.cpp:489
GiNaC::expair
A pair of expressions.
Definition: expair.h:38
GiNaC::add::do_print
void do_print(const print_context &c, unsigned level) const
Definition: add.cpp:160
GiNaC::add::return_type
unsigned return_type() const override
Definition: add.cpp:481
GiNaC::add::expand
ex expand(unsigned options=0) const override
Expand expression, i.e.
Definition: add.cpp:572
GiNaC::add::real_part
ex real_part() const override
Definition: add.cpp:416
GiNaC::add::conjugate
ex conjugate() const override
Definition: add.cpp:392
GiNaC::add::split_ex_to_pair
expair split_ex_to_pair(const ex &e) const override
Definition: add.cpp:509
GiNaC::add::do_print_latex
void do_print_latex(const print_latex &c, unsigned level) const
Definition: add.cpp:165
order
int order
Definition: integration_kernel.cpp:248
GiNaC::numeric
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Definition: numeric.h:82
GiNaC::expairseq
A sequence of class expair.
Definition: expairseq.h:50
GiNaC::add::eval
ex eval() const override
Perform automatic term rewriting rules in this class.
Definition: add.cpp:328
GiNaC::mul
Product of expressions.
Definition: mul.h:32
GiNaC::add::imag_part
ex imag_part() const override
Definition: add.cpp:433

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.