From 472c151eae2e95d5611cf3761dfe98a3fe386400 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 1 Dec 2020 14:50:38 -0500 Subject: [PATCH] eja: use symmetry when constructing the inner product matrix. --- mjo/eja/eja_algebra.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 93e148f..107adcc 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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() -- 2.43.2