2 def recurrence_memo(initial
):
4 Memo decorator for sequences defined by recurrence
6 See usage examples e.g. in the specfun/combinatorial module
14 for i
in xrange(L
, n
+1):
15 cache
.append(f(i
, cache
))
21 def assoc_recurrence_memo(base_seq
):
23 Memo decorator for associated sequences defined by recurrence starting from base
25 base_seq(n) -- callable to get base sequence elements
27 XXX works only for Pn0 = base_seq(0) cases
28 XXX works only for m <= n cases
38 for i
in xrange(L
,n
+1):
42 cache
.append(F_i_cache
)
44 # XXX only works for m <= n cases
45 # generate assoc sequence
46 for j
in xrange(1,i
+1):
48 F_i_cache
.append(F_ij
)