Hi Nicolas, On 2013-02-25, Nicolas M. Thiery <nicolas.thi...@u-psud.fr> wrote: > On the other hand, I personally consider that ``G == y`` is buggy: it > should return False; the user explicitly asked for G and y to be > distinct even if they are trivially isomorphic.
The problem that bites us here: cached_method/cached_function uses a Python dict to store values, and the tensor construction uses a cached_method. This has two consequences: 1. Comparison is by equality not identity (as usual in dictionaries). This bites us here. 2. The cache is permanent: Both the resulting tensor product *and* its factors will stay in memory forever. On the way from office to home (hence, without seeing the code), I thought that it might perhaps be possible to not use cached_method, but let the tensor product cache entirely rely on the cache of CachedRepresentation (or UniqueRepresentation). My expectation was that the tensor construction eventually constructs a CombinatorialFreeModule, whose prefix is derived from the prefixes of the factors. But alas, I was mistaken... When the cache is put into the classcall, then the preprocessing occurring in tensor_constructor will be repeatedly performed, which costs time. And I can't see a prefix being used either. Further possibilities: - Use a custom cache on the tensor_constructor, that uses weak references and comparison by identity and stuff. That would be complicated! - Make CombinatorialFreeModule a unique parent, i.e., different prefixes will result in distinct and unequal modules (as suggested by Nicolas). I mentioned in my previous post that this change will not be trivial, but perhaps it is worth it. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-combinat-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-combinat-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en. For more options, visit https://groups.google.com/groups/opt_out.