From df0184de3052598c53e064d2fff7ede8121acdfe Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 21 Feb 2021 09:39:46 -0500 Subject: [PATCH] eja: initialize CartesianProductEJA as an EJA. --- mjo/eja/eja_algebra.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 7da2207..814f357 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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 -- 2.44.2