X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=850447b38f55b09b707f745959e85dfdfa7d62c1;hb=9c771ecf5712b700f294f1ff2f18f785008f0f63;hp=3390df7545bb41257ee58c68f04154ce7a18d462;hpb=88eb54dba783144477d35d2b246bff15df438c2e;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 3390df7..850447b 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -2780,6 +2780,19 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, True sage: x.inner_product(y) == J.cartesian_inner_product(x,y) True + + The cached unit element is the same one that would be computed:: + + sage: set_random_seed() # long time + sage: J1 = random_eja() # long time + sage: J2 = random_eja() # long time + sage: J = cartesian_product([J1,J2]) # long time + sage: actual = J.one() # long time + sage: J.one.clear_cache() # long time + sage: expected = J.one() # long time + sage: actual == expected # long time + True + """ def __init__(self, modules, **kwargs): CombinatorialFreeModule_CartesianProduct.__init__(self, @@ -2819,6 +2832,8 @@ class CartesianProductEJA(CombinatorialFreeModule_CartesianProduct, check_axioms=False, category=self.category()) + ones = tuple(J.one() for J in modules) + self.one.set_cache(self._cartesian_product_of_elements(ones)) self.rank.set_cache(sum(J.rank() for J in modules)) @cached_method