From 795ac83cd78143e36d47fa267fe6ddf1ca8da111 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 4 Dec 2020 22:28:19 -0500 Subject: [PATCH] eja: reimplement multiplication_table() without member variables. --- mjo/eja/eja_algebra.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 3d49005..3b13ce1 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -614,20 +614,15 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): """ n = self.dimension() - M = [ [ self.zero() for j in range(n) ] - for i in range(n) ] - for i in range(n): - for j in range(i+1): - M[i][j] = self._multiplication_table[i][j] - M[j][i] = M[i][j] + # Prepend the header row. + M = [["*"] + list(self.gens())] - for i in range(n): - # Prepend the left "header" column entry Can't do this in - # the loop because it messes up the symmetry. - M[i] = [self.monomial(i)] + M[i] + # And to each subsequent row, prepend an entry that belongs to + # the left-side "header column." + M += [ [self.monomial(i)] + [ self.product_on_basis(i,j) + for j in range(n) ] + for i in range(n) ] - # Prepend the header row. - M = [["*"] + list(self.gens())] + M return table(M, header_row=True, header_column=True, frame=True) -- 2.44.2