From: Michael Orlitzky Date: Thu, 26 Nov 2020 22:22:26 +0000 (-0500) Subject: eja: use symmetry when constructing multiplication table. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=9a30998022fdc8eccaf724833a4cd88e545e4f0e;p=sage.d.git eja: use symmetry when constructing multiplication table. --- 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 )