X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=blobdiff_plain;f=mjo%2Feja%2Feja_subalgebra.py;h=c8bf548e2264edf8d2ee53d82f1dbf5e78ead8f7;hp=68f1ce4cf8b5f07087e4474069ad4ebe5c6a4998;hb=d15174bdec505911105c332e02aea50e7b251e7e;hpb=3f49e3bf2b85b1918c1abb0e8973a6f203dabc86 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)