From: Michael Orlitzky Date: Tue, 1 Dec 2020 19:50:38 +0000 (-0500) Subject: eja: use symmetry when constructing the inner product matrix. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=472c151eae2e95d5611cf3761dfe98a3fe386400;p=sage.d.git eja: use symmetry when constructing the inner product matrix. --- 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()