GiNaC  1.6.2
Public Member Functions | Protected Member Functions | Friends
GiNaC::add Class Reference

Sum of expressions. More...

#include <add.h>

Inheritance diagram for GiNaC::add:
GiNaC::expairseq GiNaC::basic GiNaC::refcounted

List of all members.

Public Member Functions

 add (const ex &lh, const ex &rh)
 add (const exvector &v)
 add (const epvector &v)
 add (const epvector &v, const ex &oc)
 add (std::auto_ptr< epvector > vp, const ex &oc)
unsigned precedence () const
 Return relative operator precedence (for parenthezing output).
bool info (unsigned inf) const
 Information about the object.
bool is_polynomial (const ex &var) const
 Check whether this is a polynomial in the given variables.
int degree (const ex &s) const
 Return degree of highest power in object s.
int ldegree (const ex &s) const
 Return degree of lowest power in object s.
ex coeff (const ex &s, int n=1) const
 Return coefficient of degree n in object s.
ex eval (int level=0) const
 Perform automatic term rewriting rules in this class.
ex evalm () const
 Evaluate sums, products and integer powers of matrices.
ex series (const relational &r, int order, unsigned options=0) const
 Implementation of ex::series() for sums.
ex normal (exmap &repl, exmap &rev_lookup, int level=0) const
 Implementation of ex::normal() for a sum.
numeric integer_content () const
ex smod (const numeric &xi) const
 Apply symmetric modular homomorphism to an expanded multivariate polynomial.
numeric max_coefficient () const
 Implementation ex::max_coefficient().
ex conjugate () const
ex real_part () const
ex imag_part () const
exvector get_free_indices () const
 Return a vector containing the free indices of an expression.
ex eval_ncmul (const exvector &v) const

Protected Member Functions

ex derivative (const symbol &s) const
 Implementation of ex::diff() for a sum.
unsigned return_type () const
return_type_t return_type_tinfo () const
ex thisexpairseq (const epvector &v, const ex &oc, bool do_index_renaming=false) const
 Create an object of this type.
ex thisexpairseq (std::auto_ptr< epvector > vp, const ex &oc, bool do_index_renaming=false) const
expair split_ex_to_pair (const ex &e) const
 Form an expair from an ex, using the corresponding semantics.
expair combine_ex_with_coeff_to_pair (const ex &e, const ex &c) const
expair combine_pair_with_coeff_to_pair (const expair &p, const ex &c) const
ex recombine_pair_to_ex (const expair &p) const
 Form an ex out of an expair, using the corresponding semantics.
ex expand (unsigned options=0) const
 Expand expression, i.e.
void print_add (const print_context &c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const
void do_print (const print_context &c, unsigned level) const
 Default output to stream.
void do_print_latex (const print_latex &c, unsigned level) const
void do_print_csrc (const print_csrc &c, unsigned level) const
void do_print_python_repr (const print_python_repr &c, unsigned level) const
 Python parsable output to stream.

Friends

class mul
class power

Detailed Description

Sum of expressions.

Definition at line 31 of file add.h.


Constructor & Destructor Documentation

GiNaC::add::add ( const ex lh,
const ex rh 
)
GiNaC::add::add ( const exvector v)
GiNaC::add::add ( const epvector v)
GiNaC::add::add ( const epvector v,
const ex oc 
)
GiNaC::add::add ( std::auto_ptr< epvector vp,
const ex oc 
)

Member Function Documentation

unsigned GiNaC::add::precedence ( ) const [inline, virtual]

Return relative operator precedence (for parenthezing output).

Reimplemented from GiNaC::expairseq.

Definition at line 48 of file add.h.

Referenced by do_print_csrc(), and print_add().

bool GiNaC::add::info ( unsigned  inf) const [virtual]
bool GiNaC::add::is_polynomial ( const ex var) const [virtual]

Check whether this is a polynomial in the given variables.

Reimplemented from GiNaC::basic.

Definition at line 263 of file add.cpp.

References GiNaC::expairseq::seq.

int GiNaC::add::degree ( const ex s) const [virtual]

Return degree of highest power in object s.

Reimplemented from GiNaC::basic.

Definition at line 273 of file add.cpp.

References GiNaC::ex::is_zero(), GiNaC::expairseq::overall_coeff, and GiNaC::expairseq::seq.

int GiNaC::add::ldegree ( const ex s) const [virtual]

Return degree of lowest power in object s.

Reimplemented from GiNaC::basic.

Definition at line 290 of file add.cpp.

References GiNaC::ex::is_zero(), GiNaC::expairseq::overall_coeff, and GiNaC::expairseq::seq.

ex GiNaC::add::coeff ( const ex s,
int  n = 1 
) const [virtual]
ex GiNaC::add::eval ( int  level = 0) const [virtual]

Perform automatic term rewriting rules in this class.

In the following x stands for a symbolic variables of type ex and c stands for such an expression that contain a plain number.

  • +(;c) -> c
  • +(x;0) -> x
Parameters:
levelcut-off in recursive evaluation

Reimplemented from GiNaC::expairseq.

Definition at line 344 of file add.cpp.

References GiNaC::_num1_p, add(), GiNaC::return_types::commutative, GiNaC::status_flags::dynallocated, GiNaC::expairseq::evalchildren(), GiNaC::status_flags::evaluated, GiNaC::basic::flags, GINAC_ASSERT, GiNaC::basic::hold(), GiNaC::ex::is_zero(), last, GiNaC::numeric::mul(), GiNaC::expairseq::overall_coeff, recombine_pair_to_ex(), GiNaC::expairseq::seq, GiNaC::basic::setflag(), and unlikely.

ex GiNaC::add::evalm ( ) const [virtual]

Evaluate sums, products and integer powers of matrices.

Reimplemented from GiNaC::basic.

Definition at line 407 of file add.cpp.

References add(), GiNaC::matrix::add(), GiNaC::status_flags::dynallocated, GiNaC::ex::evalm(), m, GiNaC::expairseq::overall_coeff, recombine_pair_to_ex(), GiNaC::expairseq::seq, and split_ex_to_pair().

ex GiNaC::add::series ( const relational r,
int  order,
unsigned  options = 0 
) const [virtual]

Implementation of ex::series() for sums.

This performs series addition when adding pseries objects.

See also:
ex::series

Reimplemented from GiNaC::basic.

Definition at line 776 of file pseries.cpp.

References GiNaC::_ex1, GiNaC::expairseq::op(), GiNaC::expairseq::overall_coeff, GiNaC::expairseq::seq, and GiNaC::ex::series().

ex GiNaC::add::normal ( exmap repl,
exmap rev_lookup,
int  level = 0 
) const [virtual]
numeric GiNaC::add::integer_content ( ) const [virtual]
ex GiNaC::add::smod ( const numeric xi) const [virtual]

Apply symmetric modular homomorphism to an expanded multivariate polynomial.

This function is usually used internally by heur_gcd().

Parameters:
ximodulus
Returns:
mapped polynomial
See also:
heur_gcd

Reimplemented from GiNaC::basic.

Definition at line 1214 of file normal.cpp.

References add(), coeff(), GiNaC::status_flags::dynallocated, GINAC_ASSERT, GiNaC::numeric::is_zero(), GiNaC::expairseq::overall_coeff, and GiNaC::expairseq::seq.

numeric GiNaC::add::max_coefficient ( ) const [virtual]

Implementation ex::max_coefficient().

See also:
heur_gcd

Reimplemented from GiNaC::basic.

Definition at line 1166 of file normal.cpp.

References GiNaC::abs(), GINAC_ASSERT, GiNaC::expairseq::overall_coeff, and GiNaC::expairseq::seq.

ex GiNaC::add::conjugate ( ) const [virtual]
ex GiNaC::add::real_part ( ) const [virtual]
ex GiNaC::add::imag_part ( ) const [virtual]
exvector GiNaC::add::get_free_indices ( ) const [virtual]

Return a vector containing the free indices of an expression.

Reimplemented from GiNaC::basic.

Definition at line 473 of file indexed.cpp.

References GiNaC::ex::get_free_indices(), GiNaC::indices_consistent(), GiNaC::expairseq::nops(), and GiNaC::expairseq::op().

ex GiNaC::add::eval_ncmul ( const exvector v) const [virtual]

Reimplemented from GiNaC::basic.

Definition at line 501 of file add.cpp.

References GiNaC::expairseq::seq.

ex GiNaC::add::derivative ( const symbol y) const [protected, virtual]

Implementation of ex::diff() for a sum.

It differentiates each term.

See also:
ex::diff

Reimplemented from GiNaC::basic.

Definition at line 513 of file add.cpp.

References GiNaC::_ex0, add(), combine_ex_with_coeff_to_pair(), GiNaC::status_flags::dynallocated, GiNaC::expairseq::seq, and GiNaC::basic::setflag().

unsigned GiNaC::add::return_type ( ) const [protected, virtual]

Reimplemented from GiNaC::expairseq.

Definition at line 534 of file add.cpp.

References GiNaC::return_types::commutative, and GiNaC::expairseq::seq.

return_type_t GiNaC::add::return_type_tinfo ( ) const [protected, virtual]

Reimplemented from GiNaC::basic.

Definition at line 542 of file add.cpp.

References GiNaC::expairseq::seq.

ex GiNaC::add::thisexpairseq ( const epvector v,
const ex oc,
bool  do_index_renaming = false 
) const [protected, virtual]

Create an object of this type.

This method works similar to a constructor. It is useful because expairseq has (at least) two possible different semantics but we want to inherit methods thus avoiding code duplication. Sometimes a method in expairseq has to create a new one of the same semantics, which cannot be done by a ctor because the name (add, mul,...) is unknown on the expaiseq level. In order for this trick to work a derived class must of course override this definition.

Reimplemented from GiNaC::expairseq.

Definition at line 551 of file add.cpp.

References add(), and GiNaC::status_flags::dynallocated.

ex GiNaC::add::thisexpairseq ( std::auto_ptr< epvector vp,
const ex oc,
bool  do_index_renaming = false 
) const [protected, virtual]

Reimplemented from GiNaC::expairseq.

Definition at line 557 of file add.cpp.

References add(), and GiNaC::status_flags::dynallocated.

expair GiNaC::add::split_ex_to_pair ( const ex e) const [protected, virtual]
expair GiNaC::add::combine_ex_with_coeff_to_pair ( const ex e,
const ex c 
) const [protected, virtual]
expair GiNaC::add::combine_pair_with_coeff_to_pair ( const expair p,
const ex c 
) const [protected, virtual]

Reimplemented from GiNaC::expairseq.

Definition at line 603 of file add.cpp.

References GiNaC::_ex1, GiNaC::_num1_p, GiNaC::expair::coeff, GINAC_ASSERT, and GiNaC::expair::rest.

Referenced by GiNaC::mul::eval(), and GiNaC::power::expand_add_2().

ex GiNaC::add::recombine_pair_to_ex ( const expair p) const [protected, virtual]

Form an ex out of an expair, using the corresponding semantics.

See also:
expairseq::split_ex_to_pair()

Reimplemented from GiNaC::expairseq.

Definition at line 617 of file add.cpp.

References GiNaC::_num1_p, GiNaC::expair::coeff, GiNaC::status_flags::dynallocated, mul, GiNaC::expair::rest, and GiNaC::basic::setflag().

Referenced by eval(), evalm(), GiNaC::power::expand(), imag_part(), info(), normal(), and real_part().

ex GiNaC::add::expand ( unsigned  options = 0) const [protected, virtual]

Expand expression, i.e.

multiply it out and return the result as a new expression.

Reimplemented from GiNaC::expairseq.

Definition at line 625 of file add.cpp.

References add(), GiNaC::status_flags::dynallocated, GiNaC::expairseq::expandchildren(), GiNaC::status_flags::expanded, GiNaC::expairseq::overall_coeff, and GiNaC::basic::setflag().

Referenced by normal().

void GiNaC::add::print_add ( const print_context c,
const char *  openbrace,
const char *  closebrace,
const char *  mul_sym,
unsigned  level 
) const [protected]
void GiNaC::add::do_print ( const print_context c,
unsigned  level 
) const [protected]

Default output to stream.

Reimplemented from GiNaC::expairseq.

Definition at line 156 of file add.cpp.

References print_add().

void GiNaC::add::do_print_latex ( const print_latex c,
unsigned  level 
) const [protected]

Definition at line 161 of file add.cpp.

References print_add().

void GiNaC::add::do_print_csrc ( const print_csrc c,
unsigned  level 
) const [protected]
void GiNaC::add::do_print_python_repr ( const print_python_repr c,
unsigned  level 
) const [protected]

Python parsable output to stream.

Reimplemented from GiNaC::basic.

Definition at line 210 of file add.cpp.

References GiNaC::expairseq::nops(), GiNaC::expairseq::op(), GiNaC::ex::print(), and GiNaC::print_context::s.


Friends And Related Function Documentation

friend class mul [friend]

Definition at line 35 of file add.h.

Referenced by combine_ex_with_coeff_to_pair(), recombine_pair_to_ex(), and split_ex_to_pair().

friend class power [friend]

Definition at line 36 of file add.h.


The documentation for this class was generated from the following files:

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