X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fmul.cpp;h=976db46e975c374f1659b8a2a085ffd2c83e3a9c;hp=054b2131637f01051a3b70c4d0b4abe133d63f5e;hb=ebc7c9b1ef9b051ec35a954ff2e6d2da18ab37e4;hpb=f0378a59a453a38ad1887444bf3aee773ee55de1 diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 054b2131..976db46e 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -424,6 +424,25 @@ ex mul::eval(int level) const return this->hold(); } +ex mul::evalf(int level) const +{ + if (level==1) + return mul(seq,overall_coeff); + + 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)); + } + return mul(s,overall_coeff.evalf(level)); +} + exvector mul::get_indices(void) const { // return union of indices of factors