}
return false;
}
+ case info_flags::negative: {
+ bool neg = false;
+ epvector::const_iterator i = seq.begin(), end = seq.end();
+ while (i != end) {
+ const ex& factor = recombine_pair_to_ex(*i++);
+ if (factor.info(info_flags::positive))
+ continue;
+ else if (factor.info(info_flags::negative))
+ neg = !neg;
+ else
+ return false;
+ }
+ if (overall_coeff.info(info_flags::negative))
+ neg = !neg;
+ return neg;
+ }
+ case info_flags::negint: {
+ bool neg = false;
+ epvector::const_iterator i = seq.begin(), end = seq.end();
+ while (i != end) {
+ const ex& factor = recombine_pair_to_ex(*i++);
+ if (factor.info(info_flags::posint))
+ continue;
+ else if (factor.info(info_flags::negint))
+ neg = !neg;
+ else
+ return false;
+ }
+ if (overall_coeff.info(info_flags::negint))
+ neg = !neg;
+ else if (!overall_coeff.info(info_flags::posint))
+ return false;
+ return neg;
+ }
}
return inherited::info(inf);
}
int factor, int &nummatches, const std::vector<bool> &subsed,
std::vector<bool> &matched)
{
+ GINAC_ASSERT(subsed.size() == e.nops());
+ GINAC_ASSERT(matched.size() == e.nops());
+
if (factor == (int)pat.nops())
return true;
if(is_a<mul>(pattern)) {
exmap repls;
int nummatches = std::numeric_limits<int>::max();
- std::vector<bool> subsed(seq.size(), false);
- std::vector<bool> matched(seq.size(), false);
+ std::vector<bool> subsed(nops(), false);
+ std::vector<bool> matched(nops(), false);
if(algebraic_match_mul_with_mul(*this, pattern, repls, 0, nummatches,
subsed, matched))
return true;
ex mul::algebraic_subs_mul(const exmap & m, unsigned options) const
{
- std::vector<bool> subsed(seq.size(), false);
- exvector subsresult(seq.size());
+ std::vector<bool> subsed(nops(), false);
ex divide_by = 1;
ex multiply_by = 1;
if (is_exactly_a<mul>(it->first)) {
retry1:
int nummatches = std::numeric_limits<int>::max();
- std::vector<bool> currsubsed(seq.size(), false);
+ std::vector<bool> currsubsed(nops(), false);
exmap repls;
if(!algebraic_match_mul_with_mul(*this, it->first, repls, 0, nummatches, subsed, currsubsed))