def extendedeuclide(self, a, b):
    'Return s,u,v such as s = ua + vb, s is the gcd of a and b\n        This method is used to compute the inverse of a mod b (when s=1)\n        '
    one = self.one()
    zero = self.zero()
    s = a
    u = one
    v = zero
    sp = b
    up = zero
    vp = one
    while (not sp.poly.iszero()):
        (q, r) = self.eucldiv(s, sp)
        (s, u, v, sp, up, vp) = (sp, up, vp, r, (u - (up * q)), (v - (vp * q)))
    return (self.reduc(s), self.reduc(u), self.reduc(v))
Return s,u,v such as s = ua + vb, s is the gcd of a and b
This method is used to compute the inverse of a mod b (when s=1)
def extendedeuclide(self, a, b):
    'Return s,u,v such as s = ua + vb, s is the gcd of a and b\n        This method is used to compute the inverse of a mod b (when s=1)\n        '
    one = self.one()
    zero = self.zero()
    s = a
    u = one
    v = zero
    sp = b
    up = zero
    vp = one
    while (not sp.poly.iszero()):
        (q, r) = self.eucldiv(s, sp)
        (s, u, v, sp, up, vp) = (sp, up, vp, r, (u - (up * q)), (v - (vp * q)))
    return (self.reduc(s), self.reduc(u), self.reduc(v))