X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=107adccdd6c6c44262fda89752f604c9b93c50e8;hb=472c151eae2e95d5611cf3761dfe98a3fe386400;hp=93e148f731ea6cf291fe37489d12e35470014905;hpb=04250b1b2355e0f2540340a0191734f00cdaf332;p=sage.d.git 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()