-
-
-
-class CartesianProductEJAElement(FiniteDimensionalEJAElement):
-
- def to_matrix(self):
- r"""
- SETUP::
-
- sage: from mjo.eja.eja_algebra import (HadamardEJA,
- ....: RealSymmetricEJA)
-
- EXAMPLES::
-
- sage: J1 = HadamardEJA(1)
- sage: J2 = RealSymmetricEJA(2)
- sage: J = cartesian_product([J1,J2])
- sage: x = sum(J.gens())
- sage: x.to_matrix()[0]
- [1]
- sage: x.to_matrix()[1]
- [ 1 0.7071067811865475?]
- [0.7071067811865475? 1]
-
- """
- B = self.parent().matrix_basis()
- W = self.parent().matrix_space()
-
- # Aaaaand linear combinations don't work in Cartesian
- # product spaces, even though they provide a method
- # with that name.
- pairs = zip(B, self.to_vector())
- sigma = W.zero()
- for (b,alpha) in pairs:
- # sum(...) ALSO doesn't work on Cartesian products.
- sigma += W(tuple(alpha*b_i for b_i in b))
- return sigma