]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: use symmetry when constructing multiplication table.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 26 Nov 2020 22:22:26 +0000 (17:22 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 26 Nov 2020 22:22:26 +0000 (17:22 -0500)
mjo/eja/eja_algebra.py

index a51da3e03fc753e33079fde0debdf6ee12a29b3c..c8a50f0893d97340e6cc450a2d1c9d3b47e1fe15 100644 (file)
@@ -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
         )