You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is quite simple: whenever we call compute_fixed_point(T, ...) we should update the definition of T so that any temporary arrays can be optionally supplied by the caller. See the new compute_lt_price function in the LucasTree class of quantecon/models/lucastree.py for an example (there we avoid allocating Tf on each iteration).
The text was updated successfully, but these errors were encountered:
sglyon
changed the title
ENH: make calls to compute_fixed_point not allocate memory
ENH: make calls to compute_fixed_point allocate less memory
Aug 4, 2014
@jstac, I don't think so. This is the line we would need to change. In that line we would want new_v to be passed directly into T when it is called and T would update it inplace. Note that this will require a change to the T functions also.
What about an 'inplace' option such that compute_fixed_point(T, v, inplace=True) would assume T to be a function T(v0, v1, ...) with the output being stored in v1 ?
The alternative would be to assume a call like T(v0, out=v1). In that case it is possible to automatically check whether T has an output argument.
Both options would preserve backward compatibility.
The idea is quite simple: whenever we call
compute_fixed_point(T, ...)
we should update the definition ofT
so that any temporary arrays can be optionally supplied by the caller. See the newcompute_lt_price
function in theLucasTree
class of quantecon/models/lucastree.py for an example (there we avoid allocatingTf
on each iteration).The text was updated successfully, but these errors were encountered: