]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: reimplement multiplication_table() without member variables.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 5 Dec 2020 03:28:19 +0000 (22:28 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 5 Dec 2020 03:28:19 +0000 (22:28 -0500)
mjo/eja/eja_algebra.py

index 3d49005bda1ad3c987c654b11be1ea901da5af7b..3b13ce10bbf864ceb667f3ba4fc1f8b520327292 100644 (file)
@@ -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)