]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix trivial subalgebra element constructor.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 12 Mar 2021 15:42:43 +0000 (10:42 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 12 Mar 2021 15:42:43 +0000 (10:42 -0500)
Some recent performance improvemenets necessitate a special case
for trivial subalgebras.

mjo/eja/eja_algebra.py
mjo/eja/eja_element.py
mjo/eja/eja_subalgebra.py

index e6aba200a90a0317150bde9093f6a28569d2db74..e26146ec81b5a0f922c27cca487aed9277ceb7e1 100644 (file)
@@ -1409,7 +1409,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule):
         # corresponding to trivial spaces (e.g. it returns only the
         # eigenspace corresponding to lambda=1 if you take the
         # decomposition relative to the identity element).
-        trivial = self.subalgebra(())
+        trivial = self.subalgebra((), check_axioms=False)
         J0 = trivial                          # eigenvalue zero
         J5 = VectorSpace(self.base_ring(), 0) # eigenvalue one-half
         J1 = trivial                          # eigenvalue one
index 614c399c926e6ccaf822ad39e2e438880c66c783..1c12a81bed5727b58e58980e41fd678b8334e9f3 100644 (file)
@@ -1375,7 +1375,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
             sage: (J0, J5, J1) = J.peirce_decomposition(c1)
             sage: (f0, f1, f2) = J1.gens()
             sage: f0.spectral_decomposition()
-            [(0, c2), (1, c0)]
+            [(0, 1.000000000000000?*c2), (1, 1.000000000000000?*c0)]
 
         """
         A = self.subalgebra_generated_by(orthonormalize=True)
index 68f1ce4cf8b5f07087e4474069ad4ebe5c6a4998..c8bf548e2264edf8d2ee53d82f1dbf5e78ead8f7 100644 (file)
@@ -210,7 +210,17 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA):
 
         """
         if elt in self.superalgebra():
-            return super()._element_constructor_(elt.to_matrix())
+            # If the subalgebra is trivial, its _matrix_span will be empty
+            # but we still want to be able convert the superalgebra's zero()
+            # element into the subalgebra's zero() element. There's no great
+            # workaround for this because sage checks that your basis is
+            # linearly-independent everywhere, so we can't just give it a
+            # basis consisting of the zero element.
+            m = elt.to_matrix()
+            if self.is_trivial() and m.is_zero():
+                return self.zero()
+            else:
+                return super()._element_constructor_(m)
         else:
             return super()._element_constructor_(elt)
 
@@ -227,6 +237,10 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA):
         r"""
         Return the embedding from this subalgebra into the superalgebra.
 
+        SETUP::
+
+            sage: from mjo.eja.eja_algebra import HadamardEJA
+
         EXAMPLES::
 
             sage: J = HadamardEJA(4)