I have a function of two variables, e.g.:
f[a_, b_] := f[a, b] = something f[a - 1, b - 1] etc
With the above code I used the concept of memoization to speed up the computation.
However, I have the problem that I run out of memory for large values of a
and b
.
Since my recursion is not very deep, I would like to clear the memory from time to time; for example, I calculate f[1000, 1000]
and then remove all values of f[a, b]
for a
, b
between 1 and something close to 1000.
However, I only found the Clear
/ClearAll
functions, which (unless I am missing something) clear everything indiscriminately. This is not what I want.
Is there a built-in function that does not clear all values of f[a, b]
, but just a specific range?
Comments
Post a Comment