X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fex.cpp;h=02d20e8894f1308e14850fced01d4cd43a8f0c68;hb=86639cca6eecbdf16ed3a5428351f3bb63804cac;hp=42cde03a546c2e660bbf21bdcb843c59ea927556;hpb=06eb6b761f4b9d9eed4decd8ed50d94b40b94a0e;p=ginac.git diff --git a/ginac/ex.cpp b/ginac/ex.cpp index 42cde03a..02d20e88 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -112,17 +112,6 @@ void ex::dbgprinttree(void) const bp->dbgprinttree(); } -bool ex::info(unsigned inf) const -{ - return bp->info(inf); -} - -unsigned ex::nops() const -{ - GINAC_ASSERT(bp!=0); - return bp->nops(); -} - ex ex::expand(unsigned options) const { GINAC_ASSERT(bp!=0); @@ -132,48 +121,6 @@ ex ex::expand(unsigned options) const return bp->expand(options); } -bool ex::has(const ex & other) const -{ - GINAC_ASSERT(bp!=0); - return bp->has(other); -} - -int ex::degree(const ex & s) const -{ - GINAC_ASSERT(bp!=0); - return bp->degree(s); -} - -int ex::ldegree(const ex & s) const -{ - GINAC_ASSERT(bp!=0); - return bp->ldegree(s); -} - -ex ex::coeff(const ex & s, int n) const -{ - GINAC_ASSERT(bp!=0); - return bp->coeff(s,n); -} - -ex ex::collect(const ex & s) const -{ - GINAC_ASSERT(bp!=0); - return bp->collect(s); -} - -ex ex::eval(int level) const -{ - GINAC_ASSERT(bp!=0); - return bp->eval(level); -} - -ex ex::evalf(int level) const -{ - GINAC_ASSERT(bp!=0); - return bp->evalf(level); -} - /** Compute partial derivative of an expression. * * @param s symbol by which the expression is derived @@ -189,25 +136,6 @@ ex ex::diff(const symbol & s, unsigned nth) const return bp->diff(s, nth); } -ex ex::subs(const lst & ls, const lst & lr) const -{ - GINAC_ASSERT(bp!=0); - return bp->subs(ls,lr); -} - -ex ex::subs(const ex & e) const -{ - GINAC_ASSERT(bp!=0); - return bp->subs(e); -} - -/** Return a vector containing the free indices of the object. */ -exvector ex::get_free_indices(void) const -{ - GINAC_ASSERT(bp!=0); - return bp->get_free_indices(); -} - /** Simplify/canonicalize expression containing indexed objects. This * performs contraction of dummy indices where possible and checks whether * the free indices in sums are consistent. @@ -230,12 +158,6 @@ ex ex::simplify_indexed(const scalar_products & sp) const return GiNaC::simplify_indexed(*this, sp); } -ex ex::simplify_ncmul(const exvector & v) const -{ - GINAC_ASSERT(bp!=0); - return bp->simplify_ncmul(v); -} - ex ex::operator[](const ex & index) const { debugmsg("ex operator[ex]",LOGLEVEL_OPERATOR); @@ -250,14 +172,6 @@ ex ex::operator[](int i) const return (*bp)[i]; } -/** Return operand/member at position i. */ -ex ex::op(int i) const -{ - debugmsg("ex op()",LOGLEVEL_MEMBER_FUNCTION); - GINAC_ASSERT(bp!=0); - return bp->op(i); -} - /** Return modifyable operand/member at position i. */ ex & ex::let_op(int i) { @@ -271,7 +185,8 @@ ex & ex::let_op(int i) ex ex::lhs(void) const { debugmsg("ex lhs()",LOGLEVEL_MEMBER_FUNCTION); - GINAC_ASSERT(is_ex_of_type(*this,relational)); + if (!is_ex_of_type(*this,relational)) + throw std::runtime_error("ex::lhs(): not a relation"); return (*static_cast(bp)).lhs(); } @@ -279,47 +194,11 @@ ex ex::lhs(void) const ex ex::rhs(void) const { debugmsg("ex rhs()",LOGLEVEL_MEMBER_FUNCTION); - GINAC_ASSERT(is_ex_of_type(*this,relational)); + if (!is_ex_of_type(*this,relational)) + throw std::runtime_error("ex::rhs(): not a relation"); return (*static_cast(bp)).rhs(); } -unsigned ex::return_type(void) const -{ - GINAC_ASSERT(bp!=0); - return bp->return_type(); -} - -unsigned ex::return_type_tinfo(void) const -{ - GINAC_ASSERT(bp!=0); - return bp->return_type_tinfo(); -} - -unsigned ex::gethash(void) const -{ - GINAC_ASSERT(bp!=0); - return bp->gethash(); -} - -/** Used internally by operator+() to add two ex objects together. */ -ex ex::exadd(const ex & rh) const -{ - return (new add(*this,rh))->setflag(status_flags::dynallocated); -} - -/** Used internally by operator*() to multiply two ex objects together. */ -ex ex::exmul(const ex & rh) const -{ - // Check if we are constructing a mul object or a ncmul object. Due to - // ncmul::eval()'s rule to pull out commutative elements we need to check - // only one of the elements. - if (rh.bp->return_type()==return_types::commutative || - bp->return_type()==return_types::commutative) - return (new mul(*this,rh))->setflag(status_flags::dynallocated); - else - return (new ncmul(*this,rh))->setflag(status_flags::dynallocated); -} - // private /** Make this ex writable (if more than one ex handle the same basic) by