From 21fa036e86711c6c28b6d89af2b1bfe4ceb24b29 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 24 Feb 2021 20:53:15 -0500 Subject: [PATCH] eja: fix cartesian products of cartesian product EJAs. --- mjo/eja/TODO | 3 --- mjo/eja/eja_algebra.py | 6 ------ mjo/eja/eja_element.py | 15 ++++++++++++++- mjo/eja/eja_utils.py | 8 +++----- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/mjo/eja/TODO b/mjo/eja/TODO index bde3e3b..93aa9fb 100644 --- a/mjo/eja/TODO +++ b/mjo/eja/TODO @@ -20,6 +20,3 @@ sage: a0 = (1/4)*X[4]**2*X[6]**2 - (1/2)*X[2]*X[5]*X[6]**2 - (1/2)*X[3]*X[4]*X[6 6. Profile the construction of "large" matrix algebras (like the 15-dimensional QuaternionHermitianAlgebra(3)) to find out why they're so slow. - -7. Printing of Cartesian product subalgebrasis wrong (it prints the - superalgebra). diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 8118505..618e09c 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -3133,9 +3133,3 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, FiniteDimensionalEJA.CartesianProduct = CartesianProductEJA random_eja = ConcreteEJA.random_instance -#def random_eja(*args, **kwargs): -# from sage.categories.cartesian_product import cartesian_product -# J1 = HadamardEJA(1, **kwargs) -# J2 = RealSymmetricEJA(2, **kwargs) -# J = cartesian_product([J1,J2]) -# return J diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 660cbb5..876777e 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -1403,7 +1403,20 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): SETUP:: - sage: from mjo.eja.eja_algebra import random_eja + sage: from mjo.eja.eja_algebra import (random_eja, + ....: HadamardEJA, + ....: RealSymmetricEJA) + + EXAMPLES: + + We can create subalgebras of Cartesian product EJAs that are not + themselves Cartesian product EJAs (they're just "regular" EJAs):: + + sage: J1 = HadamardEJA(3) + sage: J2 = RealSymmetricEJA(2) + sage: J = cartesian_product([J1,J2]) + sage: J.one().subalgebra_generated_by() + Euclidean Jordan algebra of dimension 1 over Algebraic Real Field TESTS: diff --git a/mjo/eja/eja_utils.py b/mjo/eja/eja_utils.py index e8ed4db..803ec63 100644 --- a/mjo/eja/eja_utils.py +++ b/mjo/eja/eja_utils.py @@ -10,12 +10,10 @@ def _all2list(x): if hasattr(x, 'list'): # Easy case... return x.list() - if hasattr(x, 'cartesian_factors'): - # If it's a formal cartesian product space element, then - # we also know what to do... - return sum(( x_i.list() for x_i in x ), []) else: - # But what if it's a tuple or something else? + # But what if it's a tuple or something else? This has to + # handle cartesian products of cartesian products, too; that's + # why it's recursive. return sum( map(_all2list,x), [] ) def _mat2vec(m): -- 2.44.2