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