Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: make calls to compute_fixed_point allocate less memory #40

Open
sglyon opened this issue Aug 4, 2014 · 3 comments
Open

ENH: make calls to compute_fixed_point allocate less memory #40

sglyon opened this issue Aug 4, 2014 · 3 comments

Comments

@sglyon
Copy link
Member

sglyon commented Aug 4, 2014

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).

@sglyon 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
Copy link
Contributor

jstac commented Oct 8, 2014

@spencerlyon2 This is done, right? Can we close?

@sglyon
Copy link
Member Author

sglyon commented Oct 8, 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.

@albop
Copy link
Contributor

albop commented Oct 9, 2014

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.

@oyamad oyamad mentioned this issue Aug 24, 2015
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants