return (new expairseq(vp,overall_coeff))->setflag(status_flags::dynallocated | status_flags::evaluated);
}
-ex expairseq::evalf(int level) const
-{
- return thisexpairseq(evalfchildren(level),overall_coeff.evalf(level-1));
-}
-
-ex expairseq::normal(lst &sym_lst, lst &repl_lst, int level) const
-{
- ex n = thisexpairseq(normalchildren(level),overall_coeff);
- return n.bp->basic::normal(sym_lst,repl_lst,level);
-}
-
bool expairseq::match(const ex & pattern, lst & repl_lst) const
{
// This differs from basic::match() because we want "a+b+c+d" to
// protected
-/** Implementation of ex::diff() for an expairseq.
- * It differentiates all elements of the sequence.
- * @see ex::diff */
-ex expairseq::derivative(const symbol &s) const
-{
- return thisexpairseq(diffchildren(s),overall_coeff);
-}
-
int expairseq::compare_same_type(const basic &other) const
{
GINAC_ASSERT(is_of_type(other, expairseq));
ex expairseq::expand(unsigned options) const
{
epvector *vp = expandchildren(options);
- if (vp==0) {
- // the terms have not changed, so it is safe to declare this expanded
- setflag(status_flags::expanded);
- return *this;
- }
-
- return thisexpairseq(vp,overall_coeff);
+ if (vp == NULL) {
+ // The terms have not changed, so it is safe to declare this expanded
+ return this->setflag(status_flags::expanded);
+ } else
+ return thisexpairseq(vp, overall_coeff);
}
//////////
}
-/** Member-wise evaluate numerically all expairs in this sequence.
- *
- * @see expairseq::evalf()
- * @return epvector with all entries evaluated numerically. */
-epvector expairseq::evalfchildren(int level) const
-{
- if (level==1)
- return seq;
-
- if (level==-max_recursion_level)
- throw(std::runtime_error("max recursion level reached"));
-
- epvector s;
- s.reserve(seq.size());
-
- --level;
- for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back(combine_ex_with_coeff_to_pair((*it).rest.evalf(level),
- (*it).coeff.evalf(level)));
- }
- return s;
-}
-
-
-/** Member-wise normalize all expairs in this sequence.
- *
- * @see expairseq::normal()
- * @return epvector with all entries normalized. */
-epvector expairseq::normalchildren(int level) const
-{
- if (level==1)
- return seq;
-
- if (level==-max_recursion_level)
- throw(std::runtime_error("max recursion level reached"));
-
- epvector s;
- s.reserve(seq.size());
-
- --level;
- for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back(combine_ex_with_coeff_to_pair((*it).rest.normal(level),
- (*it).coeff));
- }
- return s;
-}
-
-
-/** Member-wise differentiate all expairs in this sequence.
- *
- * @see expairseq::diff()
- * @return epvector with all entries differentiated. */
-epvector expairseq::diffchildren(const symbol &y) const
-{
- epvector s;
- s.reserve(seq.size());
-
- for (epvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
- s.push_back(combine_ex_with_coeff_to_pair((*it).rest.diff(y),
- (*it).coeff));
- }
- return s;
-}
-
-
/** Member-wise substitute in this sequence.
*
* @see expairseq::subs()