could easily cache the identity and charpoly coefficients using
the nontrivial factor. On the other hand, it's nice that we can
test out some alternate code paths...
+
+4. Conjecture: if x = (x1,x2), then det(x) = det(x1)det(x2).
ones = tuple(J.one().to_matrix() for J in factors)
self.one.set_cache(self(ones))
+ def _sets_keys(self):
+ r"""
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA,
+ ....: RealSymmetricEJA)
+
+ TESTS:
+
+ The superclass uses ``_sets_keys()`` to implement its
+ ``cartesian_factors()`` method::
+
+ sage: J1 = RealSymmetricEJA(2,
+ ....: field=QQ,
+ ....: orthonormalize=False,
+ ....: prefix="a")
+ sage: J2 = ComplexHermitianEJA(2,field=QQ,orthonormalize=False)
+ sage: J = cartesian_product([J1,J2])
+ sage: x = sum(i*J.gens()[i] for i in range(len(J.gens())))
+ sage: x.cartesian_factors()
+ (a1 + 2*a2, 3*b0 + 4*b1 + 5*b2 + 6*b3)
+
+ """
+ # Copy/pasted from CombinatorialFreeModule_CartesianProduct,
+ # but returning a tuple instead of a list.
+ return tuple(range(len(self.cartesian_factors())))
+
def cartesian_factors(self):
# Copy/pasted from CombinatorialFreeModule_CartesianProduct.
return self._sets