From: Michael Orlitzky Date: Sat, 13 Mar 2021 20:49:32 +0000 (-0500) Subject: eja: fix cartesian_factors() for EJA elements. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=7c21799d680433b62d48ca79cc2ea8f27e1cd8da;p=sage.d.git eja: fix cartesian_factors() for EJA elements. --- diff --git a/mjo/eja/TODO b/mjo/eja/TODO index 38cff88..421e0e9 100644 --- a/mjo/eja/TODO +++ b/mjo/eja/TODO @@ -6,3 +6,5 @@ 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). diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index d02b558..907f40d 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -3192,6 +3192,34 @@ class CartesianProductEJA(FiniteDimensionalEJA): 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