From c3b925473fca353cc16b13ab24de6664821ac305 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Feb 2021 11:51:38 -0500 Subject: [PATCH] eja: add rational-basis subclass for Cartesian products. --- mjo/eja/TODO | 5 +---- mjo/eja/eja_algebra.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/mjo/eja/TODO b/mjo/eja/TODO index 103e8d1..90a49d3 100644 --- a/mjo/eja/TODO +++ b/mjo/eja/TODO @@ -1,7 +1,4 @@ -1. Finish CartesianProductEJA: add random_instance() method and - optimize. I guess I should create a separate class hierarchy for - Cartesian products of RationalBasisEJA? That way we get fast - charpoly and random_instance() defined... +1. Add cartesian products to random_eja(). 2. Add references and start citing them. diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index d38ba87..6048363 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -3210,4 +3210,42 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, FiniteDimensionalEJA.CartesianProduct = CartesianProductEJA +class RationalBasisCartesianProductEJA(CartesianProductEJA, + RationalBasisEJA): + r""" + A separate class for products of algebras for which we know a + rational basis. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (JordanSpinEJA, + ....: RealSymmetricEJA) + + EXAMPLES: + + This gives us fast characteristic polynomial computations in + product algebras, too:: + + + sage: J1 = JordanSpinEJA(2) + sage: J2 = RealSymmetricEJA(3) + sage: J = cartesian_product([J1,J2]) + sage: J.characteristic_polynomial_of().degree() + 5 + sage: J.rank() + 5 + + """ + def __init__(self, algebras, **kwargs): + CartesianProductEJA.__init__(self, algebras, **kwargs) + + self._rational_algebra = None + if self.vector_space().base_field() is not QQ: + self._rational_algebra = cartesian_product([ + r._rational_algebra for r in algebras + ]) + + +RationalBasisEJA.CartesianProduct = RationalBasisCartesianProductEJA + random_eja = ConcreteEJA.random_instance -- 2.44.2