Yoooooooooooo !! It seems to me that you want to use some kind of caching, probably by > UniqueRepresentation or some @cached_method. > > What exactly do you mean when you say > def OA(k,n): > 1) does there exist a TD(k,n)? > Well, you know that mathematically TD(k,n) exists. I suppose you mean: > 1') does the cache of TD already contain an item for the key (k,n)? >
Hmmmm.. Well, right now there is no caching involved. This could be a nice idea in the future, but it isn't exactly a caching problem. What I mean by "Does there exist a TD(k,n)" is "Can Sage build a TD(k,n) using the several constructions of TD implemented". You don't always know if a TD(k,n) exists, and Sage contains constructions for some of them. If there is none, perhaps Sage has a OA-specific construction for a OA(k,n). In which case you would like to use it and convert the output to a TD(k,n) Nathann > > And it is easy to ask a @cached_method (or its special case, > UniqueRepresentation.__classcall__) whether the cache contains a > specific item: > > sage: C = Algebras(QQ['a,b,c']) > sage: UniqueRepresentation.__classcall__.is_in_cache(Algebras, > QQ['a','b','c']) > True > sage: UniqueRepresentation.__classcall__.is_in_cache(Algebras, > QQ['a','b','d']) > False > > A variation of following theme would work, I guess. > > class OA(UniqueRepresentation): > def __classcall_private__(cls, k, n): > try: > # Manually call the cache for TD > return UniqueRepresentation.__classcall__.cache[(TD,k,n),()] > except KeyError: > pass > try: > # Manually call the cache for MOLS > return > UniqueRepresentation.__classcall__.cache[(MOLS,k,n-2),()] > except: > pass > return UniqueRepresentation.__classcall__(OA, k, n) > > Best regards, > Simon > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.