GiNaC 1.8.7
|
This class is the ABC (abstract base class) of GiNaC's class hierarchy. More...
#include <basic.h>
Public Member Functions | |
virtual | ~basic () |
basic destructor, virtual because class ex will delete objects of derived classes via a basic*. More... | |
basic (const basic &other) | |
const basic & | operator= (const basic &other) |
basic assignment operator: the other object might be of a derived class. More... | |
virtual basic * | duplicate () const |
Create a clone of this object on the heap. More... | |
virtual ex | eval () const |
Perform automatic non-interruptive term rewriting rules. More... | |
virtual ex | evalf () const |
Evaluate object numerically. More... | |
virtual ex | evalm () const |
Evaluate sums, products and integer powers of matrices. More... | |
virtual ex | eval_integ () const |
Evaluate integrals, if result is known. More... | |
virtual ex | eval_indexed (const basic &i) const |
Perform automatic symbolic evaluations on indexed expression that contains this object as the base expression. More... | |
virtual void | print (const print_context &c, unsigned level=0) const |
Output to stream. More... | |
virtual void | dbgprint () const |
Little wrapper around print to be called within a debugger. More... | |
virtual void | dbgprinttree () const |
Little wrapper around printtree to be called within a debugger. More... | |
virtual unsigned | precedence () const |
Return relative operator precedence (for parenthezing output). More... | |
virtual bool | info (unsigned inf) const |
Information about the object. More... | |
virtual size_t | nops () const |
Number of operands/members. More... | |
virtual ex | op (size_t i) const |
Return operand/member at position i. More... | |
virtual ex | operator[] (const ex &index) const |
virtual ex | operator[] (size_t i) const |
virtual ex & | let_op (size_t i) |
Return modifiable operand/member at position i. More... | |
virtual ex & | operator[] (const ex &index) |
virtual ex & | operator[] (size_t i) |
virtual bool | has (const ex &other, unsigned options=0) const |
Test for occurrence of a pattern. More... | |
virtual bool | match (const ex &pattern, exmap &repls) const |
Check whether the expression matches a given pattern. More... | |
virtual ex | subs (const exmap &m, unsigned options=0) const |
Substitute a set of objects by arbitrary expressions. More... | |
virtual ex | map (map_function &f) const |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). More... | |
virtual void | accept (GiNaC::visitor &v) const |
virtual bool | is_polynomial (const ex &var) const |
Check whether this is a polynomial in the given variables. More... | |
virtual int | degree (const ex &s) const |
Return degree of highest power in object s. More... | |
virtual int | ldegree (const ex &s) const |
Return degree of lowest power in object s. More... | |
virtual ex | coeff (const ex &s, int n=1) const |
Return coefficient of degree n in object s. More... | |
virtual ex | expand (unsigned options=0) const |
Expand expression, i.e. More... | |
virtual ex | collect (const ex &s, bool distributed=false) const |
Sort expanded expression in terms of powers of some object(s). More... | |
virtual ex | series (const relational &r, int order, unsigned options=0) const |
Default implementation of ex::series(). More... | |
virtual ex | normal (exmap &repl, exmap &rev_lookup, lst &modifier) const |
Default implementation of ex::normal(). More... | |
virtual ex | to_rational (exmap &repl) const |
Default implementation of ex::to_rational(). More... | |
virtual ex | to_polynomial (exmap &repl) const |
virtual numeric | integer_content () const |
virtual ex | smod (const numeric &xi) const |
Apply symmetric modular homomorphism to an expanded multivariate polynomial. More... | |
virtual numeric | max_coefficient () const |
Implementation ex::max_coefficient(). More... | |
virtual exvector | get_free_indices () const |
Return a vector containing the free indices of an expression. More... | |
virtual ex | add_indexed (const ex &self, const ex &other) const |
Add two indexed expressions. More... | |
virtual ex | scalar_mul_indexed (const ex &self, const numeric &other) const |
Multiply an indexed expression with a scalar. More... | |
virtual bool | contract_with (exvector::iterator self, exvector::iterator other, exvector &v) const |
Try to contract two indexed expressions that appear in the same product. More... | |
virtual unsigned | return_type () const |
virtual return_type_t | return_type_tinfo () const |
virtual ex | conjugate () const |
virtual ex | real_part () const |
virtual ex | imag_part () const |
template<class T > | |
void | print_dispatch (const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
void | print_dispatch (const registered_class_info &ri, const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
virtual void | archive (archive_node &n) const |
Save (serialize) the object into archive node. More... | |
virtual void | read_archive (const archive_node &n, lst &syms) |
Load (deserialize) the object from an archive node. More... | |
ex | subs_one_level (const exmap &m, unsigned options) const |
Helper function for subs(). More... | |
ex | diff (const symbol &s, unsigned nth=1) const |
Default interface of nth derivative ex::diff(s, n). More... | |
int | compare (const basic &other) const |
Compare objects syntactically to establish canonical ordering. More... | |
bool | is_equal (const basic &other) const |
Test for syntactic equality. More... | |
const basic & | hold () const |
Stop further evaluation. More... | |
unsigned | gethash () const |
const basic & | setflag (unsigned f) const |
Set some status_flags. More... | |
const basic & | clearflag (unsigned f) const |
Clear some status_flags. More... | |
Public Member Functions inherited from GiNaC::refcounted | |
refcounted () noexcept | |
unsigned int | add_reference () noexcept |
unsigned int | remove_reference () noexcept |
unsigned int | get_refcount () const noexcept |
void | set_refcount (unsigned int r) noexcept |
Protected Member Functions | |
basic () | |
virtual ex | eval_ncmul (const exvector &v) const |
virtual bool | match_same_type (const basic &other) const |
Returns true if the attributes of two objects are similar enough for a match. More... | |
virtual ex | derivative (const symbol &s) const |
Default implementation of ex::diff(). More... | |
virtual int | compare_same_type (const basic &other) const |
Returns order relation between two objects of same type. More... | |
virtual bool | is_equal_same_type (const basic &other) const |
Returns true if two objects of same type are equal. More... | |
virtual unsigned | calchash () const |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. More... | |
void | ensure_if_modifiable () const |
Ensure the object may be modified without hurting others, throws if this is not the case. More... | |
void | do_print (const print_context &c, unsigned level) const |
Default output to stream. More... | |
void | do_print_tree (const print_tree &c, unsigned level) const |
Tree output to stream. More... | |
void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
Python parsable output to stream. More... | |
Protected Attributes | |
unsigned | flags |
of type status_flags More... | |
unsigned | hashvalue |
hash value More... | |
Friends | |
class | ex |
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
|
inlineprotected |
Definition at line 112 of file basic.h.
Referenced by duplicate().
|
inlinevirtual |
basic destructor, virtual because class ex will delete objects of derived classes via a basic*.
Definition at line 117 of file basic.h.
References GiNaC::status_flags::dynallocated, flags, GiNaC::refcounted::get_refcount(), and GINAC_ASSERT.
GiNaC::basic::basic | ( | const basic & | other | ) |
|
inlinevirtual |
Create a clone of this object on the heap.
One can think of this as simulating a virtual copy constructor which is needed for instance by the refcounted construction of an ex from a basic.
Reimplemented in GiNaC::realsymbol, and GiNaC::possymbol.
Definition at line 131 of file basic.h.
References basic(), GiNaC::status_flags::dynallocated, and setflag().
Referenced by GiNaC::ex::construct_from_basic(), GiNaC::idx::map(), GiNaC::idx::replace_dim(), GiNaC::idx::subs(), GiNaC::spinidx::toggle_dot(), GiNaC::varidx::toggle_variance(), and GiNaC::spinidx::toggle_variance_dot().
|
virtual |
Perform automatic non-interruptive term rewriting rules.
Reimplemented in GiNaC::add, GiNaC::expairseq, GiNaC::fderivative, GiNaC::function, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 413 of file basic.cpp.
Referenced by GiNaC::ex::construct_from_basic().
|
virtual |
Evaluate object numerically.
Reimplemented in GiNaC::constant, GiNaC::function, GiNaC::idx, GiNaC::integral, GiNaC::mul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, and GiNaC::symbol.
Definition at line 425 of file basic.cpp.
References GiNaC::nops().
Referenced by GiNaC::Kronecker_dtau_kernel::get_numerical_value(), GiNaC::Kronecker_dtau_kernel::series_coeff_impl(), and GiNaC::Kronecker_dz_kernel::series_coeff_impl().
|
virtual |
Evaluate sums, products and integer powers of matrices.
Reimplemented in GiNaC::add, GiNaC::matrix, GiNaC::mul, GiNaC::ncmul, GiNaC::power, GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 441 of file basic.cpp.
References GiNaC::map_evalm, and GiNaC::nops().
|
virtual |
Evaluate integrals, if result is known.
Reimplemented in GiNaC::integral, and GiNaC::pseries.
Definition at line 455 of file basic.cpp.
References GiNaC::map_eval_integ, and GiNaC::nops().
Reimplemented in GiNaC::add, GiNaC::clifford, GiNaC::color, GiNaC::function, GiNaC::integral, GiNaC::mul, GiNaC::power, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 686 of file basic.cpp.
References GiNaC::hold_ncmul().
Perform automatic symbolic evaluations on indexed expression that contains this object as the base expression.
Reimplemented in GiNaC::su3f, GiNaC::su3d, GiNaC::matrix, GiNaC::structure< T, ComparisonPolicy >, GiNaC::tensdelta, GiNaC::tensmetric, GiNaC::minkmetric, GiNaC::spinmetric, and GiNaC::tensepsilon.
|
virtual |
Output to stream.
This performs double dispatch on the dynamic type of *this and the dynamic type of the supplied print context.
c | print context object that describes the output formatting |
level | value that is used to identify the precedence or indentation level for placing parentheses and formatting |
Reimplemented in GiNaC::fderivative, GiNaC::function, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 116 of file basic.cpp.
References c.
Referenced by GiNaC::fderivative::print(), GiNaC::add::print_add(), GiNaC::mul::print_overall_coeff(), and GiNaC::pseries::print_series().
|
virtual |
Little wrapper around print to be called within a debugger.
This is needed because you cannot call foo.print(cout) from within the debugger because it might not know what cout is. This method can be invoked with no argument and it will simply print to stdout.
|
virtual |
Little wrapper around printtree to be called within a debugger.
|
virtual |
Return relative operator precedence (for parenthezing output).
Reimplemented in GiNaC::add, GiNaC::clifford, GiNaC::container< C >, GiNaC::expairseq, GiNaC::function, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
|
virtual |
Information about the object.
Reimplemented in GiNaC::add, GiNaC::constant, GiNaC::container< C >, GiNaC::expairseq, GiNaC::function, GiNaC::idx, GiNaC::indexed, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::relational, GiNaC::structure< T, ComparisonPolicy >, GiNaC::symbol, GiNaC::tensdelta, GiNaC::tensmetric, GiNaC::minkmetric, GiNaC::spinmetric, and GiNaC::tensepsilon.
Definition at line 222 of file basic.cpp.
Referenced by GiNaC::matrix::gauss_elimination(), GiNaC::function::info(), and GiNaC::matrix::solve().
|
virtual |
Number of operands/members.
Reimplemented in GiNaC::clifford, GiNaC::container< C >, GiNaC::expairseq, GiNaC::idx, GiNaC::integral, GiNaC::multiple_polylog_kernel, GiNaC::ELi_kernel, GiNaC::Ebar_kernel, GiNaC::Kronecker_dtau_kernel, GiNaC::Kronecker_dz_kernel, GiNaC::Eisenstein_kernel, GiNaC::Eisenstein_h_kernel, GiNaC::modular_form_kernel, GiNaC::user_defined_kernel, GiNaC::matrix, GiNaC::power, GiNaC::pseries, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 229 of file basic.cpp.
Referenced by GiNaC::su3f::eval_indexed(), GiNaC::su3d::eval_indexed(), GiNaC::matrix::eval_indexed(), GiNaC::tensmetric::eval_indexed(), GiNaC::minkmetric::eval_indexed(), GiNaC::spinmetric::eval_indexed(), GiNaC::tensepsilon::eval_indexed(), and normal().
|
virtual |
Return operand/member at position i.
Reimplemented in GiNaC::clifford, GiNaC::container< C >, GiNaC::expairseq, GiNaC::idx, GiNaC::integral, GiNaC::multiple_polylog_kernel, GiNaC::ELi_kernel, GiNaC::Ebar_kernel, GiNaC::Kronecker_dtau_kernel, GiNaC::Kronecker_dz_kernel, GiNaC::Eisenstein_kernel, GiNaC::Eisenstein_h_kernel, GiNaC::modular_form_kernel, GiNaC::user_defined_kernel, GiNaC::matrix, GiNaC::power, GiNaC::pseries, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 238 of file basic.cpp.
Referenced by GiNaC::su3f::eval_indexed(), GiNaC::su3d::eval_indexed(), GiNaC::matrix::eval_indexed(), GiNaC::tensmetric::eval_indexed(), GiNaC::minkmetric::eval_indexed(), GiNaC::spinmetric::eval_indexed(), and GiNaC::tensepsilon::eval_indexed().
Reimplemented in GiNaC::structure< T, ComparisonPolicy >.
Definition at line 250 of file basic.cpp.
References GiNaC::op(), and GiNaC::to_int().
|
virtual |
Reimplemented in GiNaC::structure< T, ComparisonPolicy >.
Definition at line 258 of file basic.cpp.
References GiNaC::op().
|
virtual |
Return modifiable operand/member at position i.
Reimplemented in GiNaC::clifford, GiNaC::container< C >, GiNaC::integral, GiNaC::multiple_polylog_kernel, GiNaC::ELi_kernel, GiNaC::Ebar_kernel, GiNaC::Kronecker_dtau_kernel, GiNaC::Kronecker_dz_kernel, GiNaC::Eisenstein_kernel, GiNaC::Eisenstein_h_kernel, GiNaC::modular_form_kernel, GiNaC::user_defined_kernel, GiNaC::matrix, and GiNaC::structure< T, ComparisonPolicy >.
Reimplemented in GiNaC::structure< T, ComparisonPolicy >.
Definition at line 263 of file basic.cpp.
References GiNaC::to_int().
|
virtual |
Reimplemented in GiNaC::structure< T, ComparisonPolicy >.
|
virtual |
Test for occurrence of a pattern.
An object 'has' a pattern if it matches the pattern itself or one of the children 'has' it. As a consequence (according to the definition of children) given e=x+y+z, e.has(x) is true but e.has(x+y) is false.
Reimplemented in GiNaC::mul, GiNaC::numeric, GiNaC::power, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 280 of file basic.cpp.
References GiNaC::ex::has(), GiNaC::match(), GiNaC::nops(), GiNaC::op(), and options.
Referenced by GiNaC::mul::has(), GiNaC::power::has(), and series().
Check whether the expression matches a given pattern.
For every wildcard object in the pattern, a pair with the wildcard as a key and matching expression as a value is added to repl_lst.
Reimplemented in GiNaC::expairseq, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::wildcard.
Definition at line 519 of file basic.cpp.
References GiNaC::ex::match(), GiNaC::ex::nops(), GiNaC::nops(), GiNaC::op(), and GiNaC::ex::op().
|
protectedvirtual |
Returns true if the attributes of two objects are similar enough for a match.
This function must not match subexpressions (this is already done by basic::match()). Only attributes not accessible by op() should be compared. This is also the reason why this function doesn't take the wildcard replacement list from match() as an argument: only subexpressions are subject to wildcard matches. Also, this function only needs to be implemented for container classes because is_equal_same_type() is automatically used instead of match_same_type() if nops() == 0.
Reimplemented in GiNaC::clifford, GiNaC::color, GiNaC::fderivative, GiNaC::function, GiNaC::idx, GiNaC::varidx, GiNaC::spinidx, GiNaC::matrix, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented in GiNaC::clifford, GiNaC::container< C >, GiNaC::expairseq, GiNaC::idx, GiNaC::matrix, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::relational, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 607 of file basic.cpp.
References GiNaC::are_ex_trivially_equal(), clearflag(), let_op(), m, GiNaC::nops(), GiNaC::op(), options, GiNaC::ex::subs(), and subs_one_level().
Referenced by GiNaC::tensmetric::eval_indexed().
|
virtual |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively).
Reimplemented in GiNaC::expairseq, GiNaC::idx, GiNaC::power, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 294 of file basic.cpp.
References GiNaC::are_ex_trivially_equal(), clearflag(), let_op(), n, GiNaC::nops(), and GiNaC::op().
Referenced by normal().
|
inlinevirtual |
|
virtual |
Check whether this is a polynomial in the given variables.
Reimplemented in GiNaC::add, GiNaC::constant, GiNaC::mul, GiNaC::numeric, GiNaC::power, and GiNaC::symbol.
Definition at line 319 of file basic.cpp.
References GiNaC::has().
|
virtual |
Return degree of highest power in object s.
Reimplemented in GiNaC::add, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
|
virtual |
Return degree of lowest power in object s.
Reimplemented in GiNaC::add, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
Return coefficient of degree n in object s.
Reimplemented in GiNaC::add, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 337 of file basic.cpp.
References GiNaC::_ex0, GiNaC::_ex1, and n.
Referenced by GiNaC::expairseq::read_archive(), series(), and GiNaC::sqrfree_parfrac().
|
virtual |
Expand expression, i.e.
multiply it out and return the result as a new expression.
Reimplemented in GiNaC::add, GiNaC::expairseq, GiNaC::function, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::power, GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 796 of file basic.cpp.
References GiNaC::nops(), and options.
Referenced by GiNaC::matrix::fraction_free_elimination(), and GiNaC::matrix::pivot().
Sort expanded expression in terms of powers of some object(s).
s | object(s) to sort in |
distributed | recursive or distributed form (only used when s is a list) |
Reimplemented in GiNaC::pseries, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 348 of file basic.cpp.
References GiNaC::_ex0, GiNaC::_ex1, GiNaC::ex::coeff(), GiNaC::coeff(), GiNaC::collect(), GiNaC::ex::degree(), GiNaC::degree(), GiNaC::expand(), GiNaC::ldegree(), n, GiNaC::ex::nops(), GiNaC::ex::op(), GiNaC::pow(), and x.
Default implementation of ex::diff().
It maps the operation on the operands (or returns 0 when the object has no operands).
Reimplemented in GiNaC::add, GiNaC::constant, GiNaC::fderivative, GiNaC::function, GiNaC::idx, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 704 of file basic.cpp.
References GiNaC::_ex0, and GiNaC::nops().
|
virtual |
Default implementation of ex::series().
This performs Taylor expansion.
Reimplemented in GiNaC::add, GiNaC::fderivative, GiNaC::function, GiNaC::integral, GiNaC::integration_kernel, GiNaC::Eisenstein_kernel, GiNaC::Eisenstein_h_kernel, GiNaC::modular_form_kernel, GiNaC::pseries, GiNaC::structure< T, ComparisonPolicy >, GiNaC::mul, GiNaC::power, and GiNaC::symbol.
Definition at line 611 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, coeff(), GiNaC::ex::diff(), GiNaC::numeric::div(), GiNaC::ex::expand(), has(), GiNaC::ex::is_zero(), n, GiNaC::subs_options::no_pattern, order, r, and GiNaC::ex::subs().
Referenced by GiNaC::lgamma_series(), GiNaC::fderivative::series(), GiNaC::function::series(), and GiNaC::power::series().
Default implementation of ex::normal().
It normalizes the children and replaces the object with a temporary symbol.
Reimplemented in GiNaC::add, GiNaC::mul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 2218 of file normal.cpp.
References GiNaC::_ex1, GiNaC::ex::info(), map(), GiNaC::info_flags::negative, GiNaC::subs_options::no_pattern, nops(), GiNaC::container< C >::nops(), GiNaC::ex::op(), GiNaC::container< C >::op(), GiNaC::replace_with_symbol(), and GiNaC::ex::subs().
Referenced by GiNaC::matrix::markowitz_elimination(), and GiNaC::matrix::solve().
Default implementation of ex::to_rational().
This replaces the object with a temporary symbol.
Reimplemented in GiNaC::expairseq, GiNaC::numeric, GiNaC::power, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 2639 of file normal.cpp.
References GiNaC::replace_with_symbol().
Reimplemented in GiNaC::expairseq, GiNaC::numeric, GiNaC::power, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
Definition at line 2644 of file normal.cpp.
References GiNaC::replace_with_symbol().
|
virtual |
Reimplemented in GiNaC::add, GiNaC::mul, GiNaC::numeric, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 323 of file normal.cpp.
References GiNaC::_num1_p.
Apply symmetric modular homomorphism to an expanded multivariate polynomial.
This function is usually used internally by heur_gcd().
xi | modulus |
Reimplemented in GiNaC::add, GiNaC::mul, GiNaC::numeric, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 1203 of file normal.cpp.
|
virtual |
Implementation ex::max_coefficient().
Reimplemented in GiNaC::add, GiNaC::mul, GiNaC::numeric, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 1161 of file normal.cpp.
References GiNaC::_num1_p.
|
virtual |
Return a vector containing the free indices of an expression.
Reimplemented in GiNaC::add, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, and GiNaC::structure< T, ComparisonPolicy >.
Add two indexed expressions.
They are guaranteed to be of class indexed (or a subclass) and their indices are compatible. This function is used internally by simplify_indexed().
self | First indexed expression; its base object is *this |
other | Second indexed expression |
Reimplemented in GiNaC::matrix, and GiNaC::structure< T, ComparisonPolicy >.
Multiply an indexed expression with a scalar.
This function is used internally by simplify_indexed().
self | Indexed expression; its base object is *this |
other | Numeric value |
Reimplemented in GiNaC::matrix, and GiNaC::structure< T, ComparisonPolicy >.
|
virtual |
Try to contract two indexed expressions that appear in the same product.
If a contraction exists, the function overwrites one or both of the expressions and returns true. Otherwise it returns false. It is guaranteed that both expressions are of class indexed (or a subclass) and that at least one dummy index has been found. This functions is used internally by simplify_indexed().
self | Pointer to first indexed expression; its base object is *this |
other | Pointer to second indexed expression |
v | The complete vector of factors |
Reimplemented in GiNaC::cliffordunit, GiNaC::diracgamma, GiNaC::su3t, GiNaC::su3f, GiNaC::su3d, GiNaC::matrix, GiNaC::structure< T, ComparisonPolicy >, GiNaC::tensdelta, GiNaC::tensmetric, GiNaC::spinmetric, and GiNaC::tensepsilon.
|
virtual |
Reimplemented in GiNaC::add, GiNaC::clifford, GiNaC::color, GiNaC::su3f, GiNaC::su3d, GiNaC::expairseq, GiNaC::fail, GiNaC::function, GiNaC::indexed, GiNaC::integral, GiNaC::matrix, GiNaC::mul, GiNaC::ncmul, GiNaC::power, GiNaC::relational, GiNaC::structure< T, ComparisonPolicy >, GiNaC::tensor, GiNaC::tensdelta, GiNaC::tensmetric, GiNaC::minkmetric, and GiNaC::tensepsilon.
|
virtual |
Reimplemented in GiNaC::add, GiNaC::clifford, GiNaC::color, GiNaC::function, GiNaC::indexed, GiNaC::integral, GiNaC::mul, GiNaC::ncmul, GiNaC::power, GiNaC::relational, and GiNaC::structure< T, ComparisonPolicy >.
Definition at line 756 of file basic.cpp.
References GiNaC::return_type_t::rl, and GiNaC::return_type_t::tinfo.
|
virtual |
Reimplemented in GiNaC::add, GiNaC::diracgamma5, GiNaC::diracgammaL, GiNaC::diracgammaR, GiNaC::constant, GiNaC::container< C >, GiNaC::expairseq, GiNaC::function, GiNaC::spinidx, GiNaC::integral, GiNaC::matrix, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::symbol, and GiNaC::realsymbol.
|
virtual |
Reimplemented in GiNaC::add, GiNaC::constant, GiNaC::container< C >, GiNaC::function, GiNaC::indexed, GiNaC::matrix, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::symbol, and GiNaC::realsymbol.
Definition at line 676 of file basic.cpp.
Referenced by GiNaC::function::real_part(), and GiNaC::ncmul::real_part().
|
virtual |
Reimplemented in GiNaC::add, GiNaC::constant, GiNaC::container< C >, GiNaC::function, GiNaC::indexed, GiNaC::matrix, GiNaC::mul, GiNaC::ncmul, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::symbol, and GiNaC::realsymbol.
Definition at line 681 of file basic.cpp.
Referenced by GiNaC::function::imag_part(), and GiNaC::ncmul::imag_part().
|
protectedvirtual |
Returns order relation between two objects of same type.
This needs to be implemented by each class. It may never return anything else than 0, signalling equality, or +1 and -1 signalling inequality and determining the canonical ordering. (Perl hackers will wonder why C++ doesn't feature the spaceship operator <=> for denoting just this.)
Definition at line 719 of file basic.cpp.
References GiNaC::compare_pointers().
Referenced by GiNaC::symbol::derivative().
|
protectedvirtual |
Returns true if two objects of same type are equal.
Normally needs not be reimplemented as long as it wasn't overwritten by some parent class, since it just calls compare_same_type(). The reason why this function exists is that sometimes it is easier to determine equality than an order relation and then it can be overridden.
Reimplemented in GiNaC::constant, GiNaC::container< C >, GiNaC::expairseq, GiNaC::fderivative, GiNaC::function, GiNaC::numeric, GiNaC::structure< T, ComparisonPolicy >, and GiNaC::symbol.
|
protectedvirtual |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so.
The method inherited from class basic computes a hash value based on the type and hash values of possible members. For this reason it is well suited for container classes but atomic classes should override this implementation because otherwise they would all end up with the same hashvalue.
Reimplemented in GiNaC::constant, GiNaC::expairseq, GiNaC::function, GiNaC::idx, GiNaC::numeric, GiNaC::relational, GiNaC::structure< T, ComparisonPolicy >, GiNaC::symbol, GiNaC::symmetry, and GiNaC::wildcard.
Definition at line 770 of file basic.cpp.
References GiNaC::ex::gethash(), GiNaC::make_hash_seed(), GiNaC::nops(), GiNaC::op(), and GiNaC::rotate_left().
Referenced by gethash().
|
inline |
Like print(), but dispatch to the specified class.
Can be used by implementations of print methods to dispatch to the method of the superclass.
Definition at line 242 of file basic.h.
References c, and print_dispatch().
Referenced by print_dispatch().
void GiNaC::basic::print_dispatch | ( | const registered_class_info & | ri, |
const print_context & | c, | ||
unsigned | level | ||
) | const |
Like print(), but dispatch to the specified class.
Can be used by implementations of print methods to dispatch to the method of the superclass.
Definition at line 126 of file basic.cpp.
References c, GiNaC::class_info< OPT >::get_parent(), and GiNaC::class_info< OPT >::options.
|
virtual |
Save (serialize) the object into archive node.
Archive the object.
Losely speaking, this method turns an expression into a byte stream (which can be saved and restored later on, or sent via network, etc.)
Reimplemented in GiNaC::clifford, GiNaC::color, GiNaC::constant, GiNaC::container< C >, GiNaC::expairseq, GiNaC::fderivative, GiNaC::function, GiNaC::idx, GiNaC::varidx, GiNaC::spinidx, GiNaC::indexed, GiNaC::integral, GiNaC::matrix, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::relational, GiNaC::symbol, GiNaC::symmetry, GiNaC::minkmetric, GiNaC::tensepsilon, and GiNaC::wildcard.
Definition at line 100 of file basic.cpp.
References n.
|
virtual |
Load (deserialize) the object from an archive node.
Construct object from archive_node.
Reimplemented in GiNaC::clifford, GiNaC::color, GiNaC::container< C >, GiNaC::constant, GiNaC::expairseq, GiNaC::fderivative, GiNaC::function, GiNaC::idx, GiNaC::varidx, GiNaC::spinidx, GiNaC::indexed, GiNaC::integral, GiNaC::matrix, GiNaC::numeric, GiNaC::power, GiNaC::pseries, GiNaC::relational, GiNaC::symbol, GiNaC::symmetry, GiNaC::minkmetric, GiNaC::tensepsilon, and GiNaC::wildcard.
Helper function for subs().
Does not recurse into subexpressions.
Definition at line 585 of file basic.cpp.
References m, GiNaC::match(), options, and GiNaC::ex::subs().
Referenced by GiNaC::mul::algebraic_subs_mul(), subs(), GiNaC::expairseq::subs(), GiNaC::numeric::subs(), GiNaC::power::subs(), GiNaC::relational::subs(), and GiNaC::symbol::subs().
Default interface of nth derivative ex::diff(s, n).
It should be called instead of ::derivative(s) for first derivatives and for nth derivatives it just recurses down.
s | symbol to differentiate in |
nth | order of differentiation |
Definition at line 646 of file basic.cpp.
References GiNaC::ex::diff(), and GiNaC::ex::is_zero().
Referenced by GiNaC::mul::derivative().
int GiNaC::basic::compare | ( | const basic & | other | ) | const |
bool GiNaC::basic::is_equal | ( | const basic & | other | ) | const |
Test for syntactic equality.
This is only a quick test, meaning objects should be in the same domain. You might have to .expand(), .normal() objects first, depending on the domain of your computation, to get a more reliable answer.
Definition at line 863 of file basic.cpp.
References gethash().
Referenced by GiNaC::ncmul::coeff(), GiNaC::power::coeff(), GiNaC::ncmul::degree(), GiNaC::power::degree(), GiNaC::ncmul::ldegree(), GiNaC::power::ldegree(), and GiNaC::wildcard::match().
const basic & GiNaC::basic::hold | ( | ) | const |
Stop further evaluation.
Definition at line 887 of file basic.cpp.
Referenced by GiNaC::abs_conjugate(), GiNaC::abs_eval(), GiNaC::abs_evalf(), GiNaC::abs_expand(), GiNaC::abs_power(), GiNaC::abs_real_part(), GiNaC::acos_eval(), GiNaC::acos_evalf(), GiNaC::acosh_eval(), GiNaC::acosh_evalf(), GiNaC::asin_eval(), GiNaC::asin_evalf(), GiNaC::asinh_eval(), GiNaC::asinh_evalf(), GiNaC::atan2_eval(), GiNaC::atan_eval(), GiNaC::atan_evalf(), GiNaC::atanh_eval(), GiNaC::atanh_evalf(), GiNaC::binomial_conjugate(), GiNaC::binomial_eval(), GiNaC::binomial_evalf(), GiNaC::binomial_real_part(), GiNaC::binomial_sym(), GiNaC::conjugate_expl_derivative(), GiNaC::cos_eval(), GiNaC::cos_evalf(), GiNaC::cosh_eval(), GiNaC::cosh_evalf(), GiNaC::csgn_power(), GiNaC::epsilon_tensor(), GiNaC::eta_imag_part(), GiNaC::add::eval(), GiNaC::expairseq::eval(), GiNaC::fderivative::eval(), GiNaC::function::eval(), GiNaC::integral::eval(), GiNaC::mul::eval(), GiNaC::numeric::eval(), GiNaC::power::eval(), GiNaC::pseries::eval(), GiNaC::structure< T, ComparisonPolicy >::eval(), GiNaC::su3f::eval_indexed(), GiNaC::su3d::eval_indexed(), GiNaC::matrix::eval_indexed(), GiNaC::structure< T, ComparisonPolicy >::eval_indexed(), GiNaC::tensmetric::eval_indexed(), GiNaC::spinmetric::eval_indexed(), GiNaC::tensepsilon::eval_indexed(), GiNaC::exp_eval(), GiNaC::exp_evalf(), GiNaC::exp_expand(), GiNaC::exp_power(), GiNaC::power::expand(), GiNaC::factorial_conjugate(), GiNaC::factorial_eval(), GiNaC::factorial_evalf(), GiNaC::factorial_real_part(), GiNaC::G2_eval(), GiNaC::G2_evalf(), GiNaC::G3_eval(), GiNaC::G3_evalf(), GiNaC::imag_part_expl_derivative(), GiNaC::iterated_integral2_eval(), GiNaC::iterated_integral3_eval(), GiNaC::iterated_integral_evalf_impl(), GiNaC::Li2_conjugate(), GiNaC::Li2_eval(), GiNaC::Li2_evalf(), GiNaC::log_eval(), GiNaC::log_evalf(), GiNaC::log_expand(), GiNaC::log_real_part(), GiNaC::lorentz_eps(), GiNaC::Order_power(), GiNaC::psi1_eval(), GiNaC::psi1_evalf(), GiNaC::psi2_eval(), GiNaC::psi2_evalf(), GiNaC::real_part_expl_derivative(), GiNaC::sin_eval(), GiNaC::sin_evalf(), GiNaC::sinh_eval(), GiNaC::sinh_evalf(), GiNaC::step_conjugate(), GiNaC::step_eval(), GiNaC::step_evalf(), GiNaC::step_real_part(), GiNaC::tan_eval(), GiNaC::tan_evalf(), GiNaC::tanh_eval(), GiNaC::tanh_evalf(), GiNaC::zeta1_eval(), GiNaC::zeta1_evalf(), GiNaC::zeta2_eval(), GiNaC::zeta2_evalf(), and GiNaC::zetaderiv_eval().
|
inline |
Definition at line 272 of file basic.h.
References calchash(), flags, GiNaC::status_flags::hash_calculated, and hashvalue.
Referenced by GiNaC::remember_table::add_entry(), compare(), is_equal(), GiNaC::remember_table_entry::is_equal(), and GiNaC::remember_table::lookup_entry().
|
inline |
Set some status_flags.
Definition at line 288 of file basic.h.
References flags.
Referenced by GiNaC::constant::calchash(), GiNaC::expairseq::calchash(), GiNaC::function::calchash(), GiNaC::idx::calchash(), GiNaC::numeric::calchash(), GiNaC::relational::calchash(), GiNaC::symbol::calchash(), GiNaC::symmetry::calchash(), GiNaC::wildcard::calchash(), GiNaC::constant::constant(), GiNaC::container< C >::container(), duplicate(), GiNaC::realsymbol::duplicate(), GiNaC::possymbol::duplicate(), GiNaC::power::eval(), GiNaC::add::expand(), GiNaC::expairseq::expand(), GiNaC::function::expand(), GiNaC::integral::expand(), GiNaC::mul::expand(), GiNaC::ncmul::expand(), GiNaC::power::expand(), GiNaC::power::expand_mul(), GiNaC::GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(), GiNaC::expairseq::info(), GiNaC::mul::info(), GiNaC::power::info(), GiNaC::log_expand(), GiNaC::matrix::matrix(), GiNaC::numeric::numeric(), GiNaC::container< C >::read_archive(), GiNaC::numeric::read_archive(), GiNaC::symbol::read_archive(), GiNaC::wildcard::read_archive(), GiNaC::reduced_matrix(), GiNaC::sub_matrix(), GiNaC::symbol::symbol(), GiNaC::symbolic_matrix(), GiNaC::symmetry::symmetry(), GiNaC::unit_matrix(), and GiNaC::wildcard::wildcard().
|
inline |
Clear some status_flags.
Definition at line 291 of file basic.h.
References flags.
Referenced by GiNaC::add::combine_ex_with_coeff_to_pair(), GiNaC::mul::eval(), GiNaC::power::eval(), GiNaC::function::function(), GiNaC::expairseq::info(), GiNaC::power::info(), map(), GiNaC::idx::map(), GiNaC::idx::replace_dim(), GiNaC::mul::smod(), GiNaC::add::split_ex_to_pair(), subs(), GiNaC::idx::subs(), GiNaC::spinidx::toggle_dot(), GiNaC::varidx::toggle_variance(), and GiNaC::spinidx::toggle_variance_dot().
|
protected |
Ensure the object may be modified without hurting others, throws if this is not the case.
Definition at line 894 of file basic.cpp.
Referenced by GiNaC::matrix::division_free_elimination(), GiNaC::matrix::fraction_free_elimination(), GiNaC::matrix::gauss_elimination(), GiNaC::clifford::let_op(), GiNaC::integral::let_op(), GiNaC::multiple_polylog_kernel::let_op(), GiNaC::ELi_kernel::let_op(), GiNaC::Ebar_kernel::let_op(), GiNaC::Kronecker_dtau_kernel::let_op(), GiNaC::Kronecker_dz_kernel::let_op(), GiNaC::Eisenstein_kernel::let_op(), GiNaC::Eisenstein_h_kernel::let_op(), GiNaC::modular_form_kernel::let_op(), GiNaC::user_defined_kernel::let_op(), GiNaC::matrix::let_op(), GiNaC::matrix::operator()(), and GiNaC::matrix::pivot().
|
protected |
|
protected |
Tree output to stream.
Definition at line 175 of file basic.cpp.
References c, GiNaC::nops(), GiNaC::op(), and GiNaC::ex::print().
|
protected |
|
friend |
Definition at line 108 of file basic.h.
Referenced by GiNaC::matrix::charpoly(), GiNaC::mul::do_print_csrc(), GiNaC::function::eval(), GiNaC::indexed::eval(), GiNaC::integral::expand(), GiNaC::power::expand_mul(), and GiNaC::structure< T, ComparisonPolicy >::scalar_mul_indexed().
|
mutableprotected |
of type status_flags
Definition at line 302 of file basic.h.
Referenced by GiNaC::expairseq::calchash(), GiNaC::function::calchash(), GiNaC::idx::calchash(), GiNaC::relational::calchash(), GiNaC::symmetry::calchash(), clearflag(), GiNaC::ex::construct_from_basic(), GiNaC::clifford::do_print_tree(), GiNaC::constant::do_print_tree(), GiNaC::expairseq::do_print_tree(), GiNaC::fderivative::do_print_tree(), GiNaC::idx::do_print_tree(), GiNaC::varidx::do_print_tree(), GiNaC::spinidx::do_print_tree(), GiNaC::indexed::do_print_tree(), GiNaC::numeric::do_print_tree(), GiNaC::pseries::do_print_tree(), GiNaC::symbol::do_print_tree(), GiNaC::symmetry::do_print_tree(), GiNaC::wildcard::do_print_tree(), GiNaC::add::eval(), GiNaC::expairseq::eval(), GiNaC::function::eval(), GiNaC::integral::eval(), GiNaC::mul::eval(), GiNaC::ncmul::eval(), GiNaC::power::eval(), GiNaC::integral::eval_integ(), GiNaC::integral::expand(), gethash(), GiNaC::expairseq::info(), GiNaC::mul::info(), GiNaC::power::info(), operator=(), GiNaC::function::print(), setflag(), and ~basic().
|
mutableprotected |
hash value
Definition at line 303 of file basic.h.
Referenced by GiNaC::constant::calchash(), GiNaC::expairseq::calchash(), GiNaC::function::calchash(), GiNaC::idx::calchash(), GiNaC::numeric::calchash(), GiNaC::relational::calchash(), GiNaC::symbol::calchash(), GiNaC::symmetry::calchash(), GiNaC::wildcard::calchash(), GiNaC::clifford::do_print_tree(), GiNaC::constant::do_print_tree(), GiNaC::expairseq::do_print_tree(), GiNaC::fderivative::do_print_tree(), GiNaC::idx::do_print_tree(), GiNaC::varidx::do_print_tree(), GiNaC::spinidx::do_print_tree(), GiNaC::indexed::do_print_tree(), GiNaC::numeric::do_print_tree(), GiNaC::pseries::do_print_tree(), GiNaC::symbol::do_print_tree(), GiNaC::symmetry::do_print_tree(), GiNaC::wildcard::do_print_tree(), gethash(), operator=(), and GiNaC::function::print().