]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: initialize CartesianProductEJA as an EJA.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 21 Feb 2021 14:39:46 +0000 (09:39 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 21 Feb 2021 14:40:05 +0000 (09:40 -0500)
mjo/eja/eja_algebra.py

index 7da2207e9bce1fdf306d06586f7f8bd0ca63e648..814f357c140e0e535e73071838ed445e9d5e6b58 100644 (file)
@@ -2742,25 +2742,35 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct,
 
     """
     def __init__(self, modules, **kwargs):
-        CombinatorialFreeModule_CartesianProduct.__init__(self, modules, **kwargs)
+        CombinatorialFreeModule_CartesianProduct.__init__(self,
+                                                          modules,
+                                                          **kwargs)
         field = modules[0].base_ring()
         if not all( J.base_ring() == field for J in modules ):
             raise ValueError("all factors must share the same base field")
 
-        M = cartesian_product( [J.matrix_space() for J in modules] )
-
-        m = len(modules)
-        W = VectorSpace(field,m)
-        self._matrix_basis = []
-        for k in range(m):
-            for a in modules[k].matrix_basis():
-                v = W.zero().list()
-                v[k] = a
-                self._matrix_basis.append(M(v))
-
-        self._matrix_basis = tuple(self._matrix_basis)
-
-        n = len(self._matrix_basis)
+        basis = tuple( b.to_vector().column() for b in self.basis() )
+
+        # Define jordan/inner products that operate on the basis.
+        def jordan_product(x_mat,y_mat):
+            x = self.from_vector(_mat2vec(x_mat))
+            y = self.from_vector(_mat2vec(y_mat))
+            return self.cartesian_jordan_product(x,y).to_vector().column()
+
+        def inner_product(x_mat, y_mat):
+            x = self.from_vector(_mat2vec(x_mat))
+            y = self.from_vector(_mat2vec(y_mat))
+            return self.cartesian_inner_product(x,y)
+
+        FiniteDimensionalEJA.__init__(self,
+                                      basis,
+                                      jordan_product,
+                                      inner_product,
+                                      field=field,
+                                      orthonormalize=False,
+                                      check_field=False,
+                                      check_axioms=False,
+                                      category=self.category())
         # TODO:
         #
         # Initialize the FDEJA class, too. Does this override the