]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: use symmetry when constructing the inner product matrix.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 1 Dec 2020 19:50:38 +0000 (14:50 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 1 Dec 2020 19:50:38 +0000 (14:50 -0500)
mjo/eja/eja_algebra.py

index 93e148f731ea6cf291fe37489d12e35470014905..107adccdd6c6c44262fda89752f604c9b93c50e8 100644 (file)
@@ -173,16 +173,27 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
             if not all( len(l) == n for l in inner_product_table ):
                 raise ValueError(msg)
 
+            # Check commutativity of the Jordan product (symmetry of
+            # the multiplication table) and the commutativity of the
+            # inner-product (symmetry of the inner-product table)
+            # first if we're going to check them at all.. This has to
+            # be done before we define product_on_basis(), because
+            # that method assumes that self._multiplication_table is
+            # symmetric. And it has to be done before we build
+            # self._inner_product_matrix, because the process used to
+            # construct it assumes symmetry as well.
             if not all(    multiplication_table[j][i]
                         == multiplication_table[i][j]
                         for i in range(n)
                         for j in range(i+1) ):
                 raise ValueError("Jordan product is not commutative")
+
             if not all( inner_product_table[j][i]
                         == inner_product_table[i][j]
                         for i in range(n)
                         for j in range(i+1) ):
                 raise ValueError("inner-product is not commutative")
+
         self._matrix_basis = matrix_basis
 
         if category is None:
@@ -222,7 +233,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         # Pre-cache the fact that these are Hermitian (real symmetric,
         # in fact) in case some e.g. matrix multiplication routine can
         # take advantage of it.
-        self._inner_product_matrix = matrix(field, inner_product_table)
+        ip_matrix_constructor = lambda i,j: inner_product_table[i][j] if j <= i else inner_product_table[j][i]
+        self._inner_product_matrix = matrix(field, n, ip_matrix_constructor)
         self._inner_product_matrix._cache = {'hermitian': True}
         self._inner_product_matrix.set_immutable()