From b259821a73cb75a6d5a81d13256802be023b0fa9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 12 Mar 2021 15:16:54 -0500 Subject: [PATCH] eja: factor a few things out of the FDEJA constructor. --- mjo/eja/TODO | 2 -- mjo/eja/eja_algebra.py | 53 ++++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/mjo/eja/TODO b/mjo/eja/TODO index 9edb379..6223bff 100644 --- a/mjo/eja/TODO +++ b/mjo/eja/TODO @@ -13,5 +13,3 @@ 5. In CartesianProductEJA we already know the multiplication table and inner product matrix. Refactor things until it's no longer necessary to duplicate that work. - -6. Figure out how to remove Unital() from subalgebras. diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index e26146e..7918759 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -170,6 +170,17 @@ from mjo.eja.eja_element import FiniteDimensionalEJAElement from mjo.eja.eja_operator import FiniteDimensionalEJAOperator from mjo.eja.eja_utils import _all2list, _mat2vec +def EuclideanJordanAlgebras(field): + r""" + The category of Euclidean Jordan algebras over ``field``, which + must be a subfield of the real numbers. For now this is just a + convenient wrapper around all of the other category axioms that + apply to all EJAs. + """ + category = MagmaticAlgebras(field).FiniteDimensional() + category = category.WithBasis().Unital().Commutative() + return category + class FiniteDimensionalEJA(CombinatorialFreeModule): r""" A finite-dimensional Euclidean Jordan algebra. @@ -228,6 +239,26 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): """ Element = FiniteDimensionalEJAElement + @staticmethod + def _check_input_field(field): + if not field.is_subring(RR): + # Note: this does return true for the real algebraic + # field, the rationals, and any quadratic field where + # we've specified a real embedding. + raise ValueError("scalar field is not real") + + @staticmethod + def _check_input_axioms(basis, jordan_product, inner_product): + if not all( jordan_product(bi,bj) == jordan_product(bj,bi) + for bi in basis + for bj in basis ): + raise ValueError("Jordan product is not commutative") + + if not all( inner_product(bi,bj) == inner_product(bj,bi) + for bi in basis + for bj in basis ): + raise ValueError("inner-product is not commutative") + def __init__(self, basis, jordan_product, @@ -244,30 +275,14 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): n = len(basis) if check_field: - if not field.is_subring(RR): - # Note: this does return true for the real algebraic - # field, the rationals, and any quadratic field where - # we've specified a real embedding. - raise ValueError("scalar field is not real") + self._check_input_field(field) if check_axioms: # Check commutativity of the Jordan and inner-products. # This has to be done before we build the multiplication # and inner-product tables/matrices, because we take # advantage of symmetry in the process. - if not all( jordan_product(bi,bj) == jordan_product(bj,bi) - for bi in basis - for bj in basis ): - raise ValueError("Jordan product is not commutative") - - if not all( inner_product(bi,bj) == inner_product(bj,bi) - for bi in basis - for bj in basis ): - raise ValueError("inner-product is not commutative") - - - category = MagmaticAlgebras(field).FiniteDimensional() - category = category.WithBasis().Unital().Commutative() + self._check_input_axioms(basis, jordan_product, inner_product) if n <= 1: # All zero- and one-dimensional algebras are just the real @@ -286,6 +301,8 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): for bj in basis for bk in basis) + category = EuclideanJordanAlgebras(field) + if associative: # Element subalgebras can take advantage of this. category = category.Associative() -- 2.43.2