From: Michael Orlitzky Date: Fri, 12 Mar 2021 15:42:43 +0000 (-0500) Subject: eja: fix trivial subalgebra element constructor. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=d15174bdec505911105c332e02aea50e7b251e7e;p=sage.d.git eja: fix trivial subalgebra element constructor. Some recent performance improvemenets necessitate a special case for trivial subalgebras. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index e6aba20..e26146e 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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 diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 614c399..1c12a81 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -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) diff --git a/mjo/eja/eja_subalgebra.py b/mjo/eja/eja_subalgebra.py index 68f1ce4..c8bf548 100644 --- a/mjo/eja/eja_subalgebra.py +++ b/mjo/eja/eja_subalgebra.py @@ -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)