From: Michael Orlitzky Date: Sat, 5 Dec 2020 03:28:19 +0000 (-0500) Subject: eja: reimplement multiplication_table() without member variables. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=795ac83cd78143e36d47fa267fe6ddf1ca8da111;p=sage.d.git eja: reimplement multiplication_table() without member variables. --- 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)