def reduc(self, a):
    ' Return a % self.irpoly\n        The polynomial a = [a_0,...,a_n-1] is returned modulo the irreducible polynomial\n        The reduced polynomial has length at most d-1 where d is the length\n        of the irreducible polynomial\n        '
    assert (a.F.F == self.F)
    if a.poly.iszero():
        return self.zero()
    elif (a.poly == self.irpoly):
        return self.zero()
    elif (a.deg < self.deg):
        c = ([self.F.zero()] * ((self.deg - 1) - a.deg))
        newacoef = (c + a.poly.coef)
        newapoly = polynom(self.F, newacoef)
        newaelem = ExtensionFieldElem(self, newapoly)
        return newaelem
    else:
        (q, r) = self.eucldiv(a, ExtensionFieldElem(self, self.irpoly))
        r = self.trunc(r)
        return self.reduc(r)
Return a % self.irpoly
The polynomial a = [a_0,...,a_n-1] is returned modulo the irreducible polynomial
The reduced polynomial has length at most d-1 where d is the length
of the irreducible polynomial
def reduc(self, a):
    ' Return a % self.irpoly\n        The polynomial a = [a_0,...,a_n-1] is returned modulo the irreducible polynomial\n        The reduced polynomial has length at most d-1 where d is the length\n        of the irreducible polynomial\n        '
    assert (a.F.F == self.F)
    if a.poly.iszero():
        return self.zero()
    elif (a.poly == self.irpoly):
        return self.zero()
    elif (a.deg < self.deg):
        c = ([self.F.zero()] * ((self.deg - 1) - a.deg))
        newacoef = (c + a.poly.coef)
        newapoly = polynom(self.F, newacoef)
        newaelem = ExtensionFieldElem(self, newapoly)
        return newaelem
    else:
        (q, r) = self.eucldiv(a, ExtensionFieldElem(self, self.irpoly))
        r = self.trunc(r)
        return self.reduc(r)