patrick-kidger / patrick-kidger/diffrax

Return value of the vector field at t0 without recomputation

Open
#741 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
2.1k
Forks
189
Avg merge
3d 18h
Merged PRs (30d)
1

Description

So I know that it's not possible to return the values of the vector field at the save times without recomputation, because in general diffrax interpolates to obtain the solution.

But shouldn't it at least possible to save the vector field at t0 without recomputation, either at the level of diffeqsolve() or at the level of step()? I am not aware of a differential equation solver that does not compute the vector field at t0.

For now, I can get around this for FSAL solvers, which contain the vector field in the solver_state. But that requires implementing a bit of annoying logic, and doesn't work for non-FSAL solvers.

So I was wondering if it was conceivable to return some output vector_field_at_t0 in the solution, or to output the value of the vector field at t0 at each step()? Or, more generally, to store the output of AbstractTerm methods at t0?

I suspect that this would be annoying to implement. But the vector field is an important quantity that I'm sure many people would like to access. So if it's available at the t0 of every step, and there is a clean way to output it, it might be worth it, and so I just wanted to put the idea out there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the diffeqsolve() and step() entry points, along with AbstractTerm methods and solver_state handling. Compare how FSAL and non-FSAL solvers obtain the vector field at t0. Done means a decided API can expose that value without recomputation across the relevant solver paths, with tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.