-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.
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