From 9a30998022fdc8eccaf724833a4cd88e545e4f0e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 26 Nov 2020 17:22:26 -0500 Subject: [PATCH] eja: use symmetry when constructing multiplication table. --- mjo/eja/eja_algebra.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index a51da3e..c8a50f0 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -134,10 +134,15 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): # long run to have the multiplication table be in terms of # algebra elements. We do this after calling the superclass # constructor so that from_vector() knows what to do. - self._multiplication_table = [ - list(map(lambda x: self.from_vector(x), ls)) - for ls in mult_table - ] + self._multiplication_table = [ [ self.vector_space().zero() + for i in range(n) ] + for j in range(n) ] + # take advantage of symmetry + for i in range(n): + for j in range(n): + elt = self.from_vector(mult_table[i][j]) + self._multiplication_table[i][j] = elt + self._multiplication_table[j][i] = elt if check_axioms: if not self._is_commutative(): @@ -1065,7 +1070,7 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr return superclass._charpoly_coefficients() mult_table = tuple( - map(lambda x: x.to_vector(), ls) + tuple(map(lambda x: x.to_vector(), ls)) for ls in self._multiplication_table ) -- 2.44.2