3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Fix pdd_iterator for non-zero constant polynomials

This commit is contained in:
Jakob Rath 2023-09-28 11:42:08 +02:00
parent 78b5db3ce7
commit e96f69e76c
3 changed files with 47 additions and 6 deletions

View file

@ -1969,6 +1969,9 @@ namespace dd {
n = m.hi(n);
}
m_mono.coeff = m.val(n);
// if m_pdd is constant and non-zero, the iterator should return a single monomial
if (m_nodes.empty() && !m_mono.coeff.is_zero())
m_nodes.push_back(std::make_pair(false, n));
}
pdd_iterator pdd::begin() const { return pdd_iterator(*this, true); }

View file

@ -570,7 +570,7 @@ namespace dd {
pdd_iterator& operator++() { next(); return *this; }
pdd_iterator operator++(int) { auto tmp = *this; next(); return tmp; }
bool operator==(pdd_iterator const& other) const { return m_nodes == other.m_nodes; }
bool operator!=(pdd_iterator const& other) const { return m_nodes != other.m_nodes; }
bool operator!=(pdd_iterator const& other) const { return !operator==(other); }
};
class pdd_linear_iterator {