Skip to content

Reduce allocations in evaluate_policy! #75

Description

@oyamad

Current code path

evaluate_policy! currently:

  • copies cdp.interp.Phi into a dense matrix A
  • loops over states and shocks
  • subtracts ckron([vec(evalbase(...)) ...]) * discount * w
  • factorizes A with lu
  • solves with ldiv!

Possible directions

  • reduce temporary allocations from evalbase, collect, and ckron
  • use more workspaces during matrix assembly
  • investigate whether the matrix assembly can be made more structured/in-place

(AI assisted (ChatGPT Pro 5.4) in drafting this issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions