(self, a)
Compute a**(-1), if possible.
Compute a**(-1), if possible.
Compute a ** ( - 1 ) if possible .
def revert(self, a):
        """
        Compute a**(-1), if possible.
        """
        I = self.ring.ideal(a.data) + self.base_ideal
        try:
            return self(I.in_terms_of_generators(1)[0])
        except ValueError:  # 1 not in I
            raise NotReversible('%s not a unit in %r' % (a, self))
def revert ( self , a ) : I = self . ring . ideal ( a . data ) + self . base_ideal try : return self ( I . in_terms_of_generators ( 1 ) [ 0 ] ) except ValueError : # 1 not in I raise NotReversible ( '%s not a unit in %r' % ( a , self ) )