]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix some more super/subalgebra back and forth.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Aug 2019 23:36:15 +0000 (19:36 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 2 Aug 2019 23:36:15 +0000 (19:36 -0400)
This fixes all of the outright crashes in the test suite, but the
multiplication table in the subalgebra is still broken (it isn't
associative).

mjo/eja/eja_element.py

index 5b9142496f434be0a7c4dc014816302262eb33a5..e38012eb3bf9cda640c8cc4c4ef8d822e194ce43 100644 (file)
@@ -410,7 +410,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
             sage: coeff = ~(x0^2 - x_bar.inner_product(x_bar))
             sage: inv_vec = x_vec.parent()([x0] + (-x_bar).list())
             sage: x_inverse = coeff*inv_vec
-            sage: x.inverse() == J(x_inverse)
+            sage: x.inverse() == J.from_vector(x_inverse)
             True
 
         TESTS:
@@ -722,7 +722,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
 
         """
         A = self.subalgebra_generated_by()
-        return A.element_class(A,self).operator().minimal_polynomial()
+        return A(self).operator().minimal_polynomial()
 
 
 
@@ -938,11 +938,17 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
 
             sage: from mjo.eja.eja_algebra import random_eja
 
-        TESTS::
+        TESTS:
+
+        This subalgebra, being composed of only powers, is associative::
 
             sage: set_random_seed()
-            sage: x = random_eja().random_element()
-            sage: x.subalgebra_generated_by().is_associative()
+            sage: x0 = random_eja().random_element()
+            sage: A = x0.subalgebra_generated_by()
+            sage: x = A.random_element()
+            sage: y = A.random_element()
+            sage: z = A.random_element()
+            sage: (x*y)*z == x*(y*z)
             True
 
         Squaring in the subalgebra should work the same as in
@@ -983,7 +989,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
             raise ValueError("this only works with non-nilpotent elements!")
 
         J = self.subalgebra_generated_by()
-        u = J.from_vector(self.to_vector())
+        u = J(self)
 
         # The image of the matrix of left-u^m-multiplication
         # will be minimal for some natural number s...
@@ -1008,7 +1014,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
         # Our FiniteDimensionalAlgebraElement superclass uses rows.
         u_next = u**(s+1)
         A = u_next.operator().matrix()
-        c = J(A.solve_right(u_next.to_vector()))
+        c = J.from_vector(A.solve_right(u_next.to_vector()))
 
         # Now c is the idempotent we want, but it still lives in the subalgebra.
         return c.superalgebra_element()