From: Michael Orlitzky Date: Fri, 26 Jul 2019 00:40:21 +0000 (-0400) Subject: eja: ensure that the element inverse() always lives back in the EJA. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=8f7ecef93d07a3f969d1c944c80b75a7052a4975;hp=87644b67c69d96150793929470507522a8fa2b0b;p=sage.d.git eja: ensure that the element inverse() always lives back in the EJA. --- diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 2fa4800..a469bb0 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -699,14 +699,13 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): True """ + if not self.is_invertible(): + raise ValueError("element not invertible") + if self.parent().is_associative(): elt = FiniteDimensionalAlgebraElement(self.parent(), self) - return elt.inverse() - - # TODO: we can do better once the call to is_invertible() - # doesn't crash on irregular elements. - #if not self.is_invertible(): - # raise ValueError('element is not invertible') + # elt is in the right coordinates, but has the wrong class. + return self.parent()(elt.inverse().vector()) # We do this a little different than the usual recursive # call to a finite-dimensional algebra element, because we