]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_algebra.py
eja: demonstration for https://trac.sagemath.org/ticket/31421.
[sage.d.git] / mjo / eja / eja_algebra.py
index a77bb871def9264ac0a82dfea4737b6c2b4411fc..e6a60929055fccb28fd86765e7743a028b1904a1 100644 (file)
@@ -2690,7 +2690,8 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
 
     SETUP::
 
-        sage: from mjo.eja.eja_algebra import (CartesianProductEJA,
+        sage: from mjo.eja.eja_algebra import (random_eja,
+        ....:                                  CartesianProductEJA,
         ....:                                  HadamardEJA,
         ....:                                  JordanSpinEJA,
         ....:                                  RealSymmetricEJA)
@@ -2740,6 +2741,19 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
         ...
         ValueError: all factors must share the same base field
 
+    The "cached" Jordan and inner products are the componentwise
+    ones::
+
+        sage: set_random_seed()
+        sage: J1 = random_eja()
+        sage: J2 = random_eja()
+        sage: J = cartesian_product([J1,J2])
+        sage: x,y = J.random_elements(2)
+        sage: x*y == J.cartesian_jordan_product(x,y)
+        True
+        sage: x.inner_product(y) == J.cartesian_inner_product(x,y)
+        True
+
     """
     def __init__(self, modules, **kwargs):
         CombinatorialFreeModule_CartesianProduct.__init__(self,
@@ -2852,8 +2866,11 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
 
         """
         Ji = self.cartesian_factors()[i]
-        # Requires the fix on Trac 31421/31422 to work!
-        Pi = super().cartesian_projection(i)
+
+        # Required until https://trac.sagemath.org/ticket/31421 is fixed.
+        Pi = self.module_morphism(lambda j_t: Ji.monomial(j_t[1])
+                                  if i == j_t[0] else Ji.zero(),
+                                  codomain=Ji)
         return FiniteDimensionalEJAOperator(self,Ji,Pi.matrix())
 
     @cached_method
@@ -2960,8 +2977,9 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
 
         """
         Ji = self.cartesian_factors()[i]
-        # Requires the fix on Trac 31421/31422 to work!
-        Ei = super().cartesian_embedding(i)
+        # Required until https://trac.sagemath.org/ticket/31421 is fixed.
+        Ei = Ji.module_morphism(lambda t: self.monomial((i, t)),
+                                codomain=self)
         return FiniteDimensionalEJAOperator(Ji,self,Ei.matrix())