From: Michael Orlitzky Date: Fri, 26 Feb 2021 14:08:35 +0000 (-0500) Subject: eja: override product_on_basis() for Cartesian products. X-Git-Url: http://gitweb.michael.orlitzky.com/?p=sage.d.git;a=commitdiff_plain;h=429dda48b69d960fb71a3e321b07097d2eae6965 eja: override product_on_basis() for Cartesian products. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index db1e63d..00de418 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -3196,6 +3196,47 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, self.one.set_cache(self._cartesian_product_of_elements(ones)) self.rank.set_cache(sum(J.rank() for J in algebras)) + def product_on_basis(self, i, j): + r""" + Return the product of the monomials indexed by ``i`` and ``j``. + + This overrides the superclass method because here, both ``i`` + and ``j`` will be ordered pairs. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA, + ....: JordanSpinEJA, + ....: RealSymmetricEJA) + + TESTS:: + + sage: J1 = RealSymmetricEJA(2,field=QQ,orthonormalize=False) + sage: J2 = ComplexHermitianEJA(0,field=QQ,orthonormalize=False) + sage: J3 = JordanSpinEJA(2,field=QQ,orthonormalize=False) + sage: J = cartesian_product([J1,J2,J3]) + sage: x = sum(J.gens()) + sage: x*J.one() + e(0, 0) + e(0, 1) + e(0, 2) + e(2, 0) + e(2, 1) + sage: x*x + 2*e(0, 0) + 2*e(0, 1) + 2*e(0, 2) + 2*e(2, 0) + 2*e(2, 1) + + """ + factor = i[0] + assert(j[0] == i[0]) + n = self.cartesian_factors()[factor].dimension() + + # The superclass method indexes into a matrix, so we have to + # turn the tuples i and j into integers. This is easy enough + # 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. And of course + # we should never be multiplying two elements from different + # factors. + l = n*factor + i[1] + m = n*factor + j[1] + super().product_on_basis(l, m) + def matrix_space(self): r""" Return the space that our matrix basis lives in as a Cartesian