From 12178d0b2943c4fe22c34c57171c794bec6a853a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 18 Oct 2020 01:24:18 -0400 Subject: [PATCH] eja: fix sub-subalgebra element construction. --- mjo/eja/eja_element_subalgebra.py | 9 +++++++-- mjo/eja/eja_subalgebra.py | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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)) -- 2.44.2