Skip to content

ENH: make calls to compute_fixed_point allocate less memory #40

@sglyon

Description

@sglyon
Member

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

Activity

changed the title [-]ENH: make calls to `compute_fixed_point` not allocate memory[/-] [+]ENH: make calls to `compute_fixed_point` allocate less memory[/+] on Aug 4, 2014
jstac

jstac commented on Oct 8, 2014

@jstac
Contributor

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

sglyon

sglyon commented on Oct 8, 2014

@sglyon
MemberAuthor

@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

albop commented on Oct 9, 2014

@albop
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @albop@sglyon@jstac

        Issue actions

          ENH: make calls to `compute_fixed_point` allocate less memory · Issue #40 · QuantEcon/QuantEcon.py