From: Michael Orlitzky Date: Sun, 18 Oct 2020 05:24:18 +0000 (-0400) Subject: eja: fix sub-subalgebra element construction. X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=commitdiff_plain;h=12178d0b2943c4fe22c34c57171c794bec6a853a eja: fix sub-subalgebra element construction. --- diff --git a/mjo/eja/eja_element_subalgebra.py b/mjo/eja/eja_element_subalgebra.py index 7fbd060..cff8b4e 100644 --- a/mjo/eja/eja_element_subalgebra.py +++ b/mjo/eja/eja_element_subalgebra.py @@ -163,5 +163,10 @@ class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclide return self.zero() else: sa_one = self.superalgebra().one().to_vector() - sa_coords = self.vector_space().coordinate_vector(sa_one) - return self.from_vector(sa_coords) + # The extra hackery is because foo.to_vector() might not + # live in foo.parent().vector_space()! + coords = sum( a*b for (a,b) + in zip(sa_one, + self.superalgebra().vector_space().basis()) ) + return self.from_vector(self.vector_space().coordinate_vector(coords)) + diff --git a/mjo/eja/eja_subalgebra.py b/mjo/eja/eja_subalgebra.py index ac77f22..4355e9f 100644 --- a/mjo/eja/eja_subalgebra.py +++ b/mjo/eja/eja_subalgebra.py @@ -215,8 +215,12 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda if elt not in self.superalgebra(): raise ValueError("not an element of this subalgebra") - coords = self.vector_space().coordinate_vector(elt.to_vector()) - return self.from_vector(coords) + # The extra hackery is because foo.to_vector() might not + # live in foo.parent().vector_space()! + coords = sum( a*b for (a,b) + in zip(elt.to_vector(), + self.superalgebra().vector_space().basis()) ) + return self.from_vector(self.vector_space().coordinate_vector(coords))