- ones = tuple(J.one() for J in algebras)
- self.one.set_cache(self._cartesian_product_of_elements(ones))
- self.rank.set_cache(sum(J.rank() for J in algebras))
-
- def _monomial_to_generator(self, mon):
- r"""
- Convert a monomial index into a generator index.
-
- SETUP::
-
- sage: from mjo.eja.eja_algebra import random_eja()
-
- TESTS::
-
- sage: J1 = random_eja(field=QQ, orthonormalize=False)
- sage: J2 = random_eja(field=QQ, orthonormalize=False)
- sage: J = cartesian_product([J1,J2])
- sage: all( J.monomial(m)
- ....: ==
- ....: J.gens()[J._monomial_to_generator(m)]
- ....: for m in J.basis().keys() )
-
- """
- # 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.
- factor = mon[0]
- idx_in_factor = mon[1]
+ ones = tuple(J.one().to_matrix() for J in factors)
+ self.one.set_cache(self(ones))
+ self.rank.set_cache(sum(J.rank() for J in factors))