]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: start fixing Cartesian products of Cartesian products.
[sage.d.git] / mjo / eja / eja_algebra.py
index cbe5c08a344a95248e0b7c15e94de80b0c662816..c1fc8078823eb8915f3caad13d55c8e2f61025bf 100644 (file)
@@ -3220,8 +3220,11 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
         # given that the first coordinate of i and j corresponds to
         # the factor, and the second coordinate corresponds to the
         # index of the generator within that factor.
-        factor = mon[0]
-        idx_in_factor = mon[1]
+        try:
+            factor = mon[0]
+        except TypeError: # 'int' object is not subscriptable
+            return mon
+        idx_in_factor = self._monomial_to_generator(mon[1])
 
         offset = sum( f.dimension()
                       for f in self.cartesian_factors()[:factor] )
@@ -3236,8 +3239,24 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
 
         SETUP::
 
-            sage: from mjo.eja.eja_algebra import (QuaternionHermitianEJA,
-            ....:                                  RealSymmetricEJA)
+            sage: from mjo.eja.eja_algebra import (HadamardEJA,
+            ....:                                  JordanSpinEJA,
+            ....:                                  QuaternionHermitianEJA,
+            ....:                                  RealSymmetricEJA,)
+
+        EXAMPLES::
+
+            sage: J1 = JordanSpinEJA(2, field=QQ)
+            sage: J2 = RealSymmetricEJA(2, field=QQ, orthonormalize=False)
+            sage: J3 = HadamardEJA(1, field=QQ)
+            sage: K1 = cartesian_product([J1,J2])
+            sage: K2 = cartesian_product([K1,J3])
+            sage: list(K2.basis())
+            [e(0, (0, 0)), e(0, (0, 1)), e(0, (1, 0)), e(0, (1, 1)),
+            e(0, (1, 2)), e(1, 0)]
+            sage: sage: g = K2.gens()
+            sage: (g[0] + 2*g[3]) * (g[1] - 4*g[2])
+            e(0, (0, 1)) - 4*e(0, (1, 1))
 
         TESTS::