Beispiel #1
0
void UnivariateIntPolynomial::dict_add_term(map_uint_mpz &d,
                                            const integer_class &coef,
                                            const unsigned int &n)
{
    auto it = d.find(n);
    if (it == d.end())
        d[n] = coef;
}
Beispiel #2
0
bool map_uint_mpz_eq(const map_uint_mpz &a,
        const map_uint_mpz &b)
{
    // Can't be equal if # of entries differ:
    if (a.size() != b.size()) return false;
    // Loop over keys in "a":
    for (const auto &p: a) {
        auto f = b.find(p.first);
        if (f == b.end()) return false; // no such element in "b"
        if (p.second != f->second) return false; // values not equal
    }
    return true;
}