X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=blobdiff_plain;f=mjo%2Feja%2Feja_element.py;fp=mjo%2Feja%2Feja_element.py;h=85ec494e53beaf05c788dbd5b04a23a18c0952d6;hp=6997766319798e5188683972c303ce450f0303e3;hb=1a8af0a2d9398932b8e4ac2b35a7fb4d7094654c;hpb=62d5ba7426cdf164ab6f0f92e6adcde6c6f98a2b diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 6997766..85ec494 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -506,15 +506,18 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): True """ not_invertible_msg = "element is not invertible" - if self.parent()._charpoly_coefficients.is_in_cache(): + + algebra = self.parent() + if algebra._charpoly_coefficients.is_in_cache(): # We can invert using our charpoly if it will be fast to # compute. If the coefficients are cached, our rank had # better be too! if self.det().is_zero(): raise ZeroDivisionError(not_invertible_msg) - r = self.parent().rank() + r = algebra.rank() a = self.characteristic_polynomial().coefficients(sparse=False) - return (-1)**(r+1)*sum(a[i+1]*self**i for i in range(r))/self.det() + return (-1)**(r+1)*algebra.sum(a[i+1]*self**i + for i in range(r))/self.det() try: inv = (~self.quadratic_representation())(self)