X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=5d96a53f402f4f3343cc396049b4311d13fa3ba1;hb=8059516ad9df112ac18c740af7d6f856639d4b8d;hp=ad619f667a853e191f254aa32aaed3664e27f6a5;hpb=f85bca2ff71a537c82fae3736944ce8896c30251;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index ad619f6..5d96a53 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -3115,6 +3115,33 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, sage: CP2.is_associative() False + Cartesian products of Cartesian products work:: + + sage: J1 = JordanSpinEJA(1) + sage: J2 = JordanSpinEJA(1) + sage: J3 = JordanSpinEJA(1) + sage: J = cartesian_product([J1,cartesian_product([J2,J3])]) + sage: J.multiplication_table() + +--------------++---------+--------------+--------------+ + | * || e(0, 0) | e(1, (0, 0)) | e(1, (1, 0)) | + +==============++=========+==============+==============+ + | e(0, 0) || e(0, 0) | 0 | 0 | + +--------------++---------+--------------+--------------+ + | e(1, (0, 0)) || 0 | e(1, (0, 0)) | 0 | + +--------------++---------+--------------+--------------+ + | e(1, (1, 0)) || 0 | 0 | e(1, (1, 0)) | + +--------------++---------+--------------+--------------+ + sage: HadamardEJA(3).multiplication_table() + +----++----+----+----+ + | * || e0 | e1 | e2 | + +====++====+====+====+ + | e0 || e0 | 0 | 0 | + +----++----+----+----+ + | e1 || 0 | e1 | 0 | + +----++----+----+----+ + | e2 || 0 | 0 | e2 | + +----++----+----+----+ + TESTS: All factors must share the same base field:: @@ -3200,6 +3227,9 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, r""" Convert a monomial index into a generator index. + This is needed in product algebras because the multiplication + table is in terms of the generator indices. + SETUP:: sage: from mjo.eja.eja_algebra import random_eja @@ -3216,15 +3246,15 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, True """ - # 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. + # This works recursively so that we can handle Cartesian + # products of Cartesian products. try: + # monomial is an ordered pair factor = mon[0] except TypeError: # 'int' object is not subscriptable + # base case where the monomials are integers return mon + idx_in_factor = self._monomial_to_generator(mon[1]) offset = sum( f.dimension()