X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_element.py;h=739bff334c5aa2069dbf09244e7a7fa39ceaccb3;hb=825ba059499cb402a58b5d10b2d505e1f1258fbf;hp=a5880c4c4c3fc083726fbf2adcef6ee071e7cd63;hpb=fe2af66b109e9487a59f21d5b67bb5c4aafdc98d;p=sage.d.git diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index a5880c4..739bff3 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -523,6 +523,11 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): whether or not the paren't algebra's zero element is a root of this element's minimal polynomial. + That is... unless the coefficients of our algebra's + "characteristic polynomial of" function are already cached! + In that case, we just use the determinant (which will be fast + as a result). + Beware that we can't use the superclass method, because it relies on the algebra being associative. @@ -553,6 +558,11 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): else: return False + if self.parent()._charpoly_coefficients.is_in_cache(): + # The determinant will be quicker than computing the minimal + # polynomial from scratch, most likely. + return (not self.det().is_zero()) + # In fact, we only need to know if the constant term is non-zero, # so we can pass in the field's zero element instead. zero = self.base_ring().zero()