Ejemplo n.º 1
0
FFElement FiniteField::makeElement(const Polynomial& p) const {
    assert(p.getMod() == getP());
    if (p.getDomain() == domain) return FFElement(p, this);
    std::vector<FieldElement> coeffs;
    for (auto& c : p.getCoeffs()) coeffs.push_back(domain->getField()->makeElement(c.getVal()));
    return FFElement(domain->makeElement(coeffs), this);
}
Ejemplo n.º 2
0
FiniteField::FiniteField(const Polynomial& irred) : p(irred.getMod()), k(irred.degree()), domain(irred.getDomain()), modulus(irred) {
    //assert(k > 1 && "Use PrimeField if k==1");
    assert(irred.isIrreducible());
}