]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_element.py
eja: use orthonormalize=False for all subalgebra_generated_by() tests.
[sage.d.git] / mjo / eja / eja_element.py
index 2c425ca320a5c04e6defee044bd0deb01e76dda4..bc253d48653c40bddb3180e083daf6b61e9f3dac 100644 (file)
@@ -375,7 +375,8 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         Ensure that the determinant is multiplicative on an associative
         subalgebra as in Faraut and Korányi's Proposition II.2.2::
 
-            sage: J = random_eja().random_element().subalgebra_generated_by()
+            sage: x0 = random_eja().random_element()
+            sage: J = x0.subalgebra_generated_by(orthonormalize=False)
             sage: x,y = J.random_elements(2)
             sage: (x*y).det() == x.det()*y.det()
             True
@@ -484,10 +485,12 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         of an element is the inverse of its left-multiplication operator
         applied to the algebra's identity, when that inverse exists::
 
-            sage: J = random_eja()
-            sage: x = J.random_element()
-            sage: (not x.operator().is_invertible()) or (
-            ....:    x.operator().inverse()(J.one()) == x.inverse() )
+            sage: J = random_eja()                         # long time
+            sage: x = J.random_element()                   # long time
+            sage: (not x.operator().is_invertible()) or (  # long time
+            ....:    x.operator().inverse()(J.one())       # long time
+            ....:    ==                                    # long time
+            ....:    x.inverse() )                         # long time
             True
 
         Check that the fast (cached) and slow algorithms give the same
@@ -504,15 +507,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)
@@ -976,9 +982,9 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
 
         The minimal polynomial should always kill its element::
 
-            sage: x = random_eja().random_element()
-            sage: p = x.minimal_polynomial()
-            sage: x.apply_univariate_polynomial(p)
+            sage: x = random_eja().random_element()  # long time
+            sage: p = x.minimal_polynomial()         # long time
+            sage: x.apply_univariate_polynomial(p)   # long time
             0
 
         The minimal polynomial is invariant under a change of basis,
@@ -1371,7 +1377,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         This subalgebra, being composed of only powers, is associative::
 
             sage: x0 = random_eja().random_element()
-            sage: A = x0.subalgebra_generated_by()
+            sage: A = x0.subalgebra_generated_by(orthonormalize=False)
             sage: x,y,z = A.random_elements(3)
             sage: (x*y)*z == x*(y*z)
             True
@@ -1380,7 +1386,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         the superalgebra::
 
             sage: x = random_eja().random_element()
-            sage: A = x.subalgebra_generated_by()
+            sage: A = x.subalgebra_generated_by(orthonormalize=False)
             sage: A(x^2) == A(x)*A(x)
             True