Skip to content

Add Better Discretizers - #299

Merged
mattlevine22 merged 13 commits into
mainfrom
dw-better-discretizers-v2
Aug 18, 2026
Merged

Add Better Discretizers#299
mattlevine22 merged 13 commits into
mainfrom
dw-better-discretizers-v2

Conversation

@DanWaxman

Copy link
Copy Markdown
Collaborator

Supersedes #226. Includes better discretization schemes to be used, and a notebook showing a simple comparison.

I've gone through & iterated on the resulting code structure & included methods quite closely, which looks good to me. What remains is a closer look at the mathematical correctness + some interrogation of the config files, which I think got a bit bloated with overly technical details.

@mattlevine22 mattlevine22 mentioned this pull request Aug 13, 2026
@DanWaxman
DanWaxman marked this pull request as ready for review August 17, 2026 21:11
@DanWaxman
DanWaxman requested a review from mattlevine22 August 17, 2026 21:11

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "...250 evenly spaced...". I caught that w mine own eyes too!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and on interval [0, 10]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed (though now 100 evenly spaced on [0, 4]; finer discretization took a long time otherwise).

@mattlevine22 mattlevine22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this is great! Can you please (a) update the notebook a bit per below and (b) take a look at codex's complaint below and decide if it is worth chasing down?

Some simple suggestions for improving the notebook:

  1. make the notation for all the different discretization the same and canonical:

p(x_k+1 | x_k, u_k, t_k, t_k+1) \approx ...

  1. Run diffrax-Euler with dt=1e-3 and show that it does better

  2. Give some recommendations at the end:

  • for high-dimensional systems, ...
  • for slow/fast sample-rate systems, ...
  • for nearly-linear systems ...
  • for stiff systems, ...

Also flagging a Codex complaint:

[P1] The Van Loan covariance calculation is unstable in default float32. In exact_affine.py (line 71), the block exponential contains -F.T. For a stable scalar system F=-100, L=1, and h=1, the exact covariance is approximately 0.005, but the implementation overflows and raises “non-finite transition covariance.” This also affects local linearization and is especially problematic because automatic routing now sends every eligible affine model through this path. It needs a numerically stable covariance algorithm and a stiff-system regression test.

@mattlevine22

Copy link
Copy Markdown
Collaborator

@DanWaxman sorry to add 1 more thing, but can we add to the existing SDE L63 tutorial that uses a new Discretizer w Cuthbert EnKF and compare the posterior and the compute time to cd-dynamax EnKF?

@DanWaxman

Copy link
Copy Markdown
Collaborator Author

Thanks! Made the updates! Also introduced a better scaled version of the van Loan solver. Solves over a smaller interval if the matrix norm is large; e.g., solve over h/2 instead of h, then apply A_{h/2} A_{h/2} = A_h.

@DanWaxman
DanWaxman requested a review from mattlevine22 August 17, 2026 23:42
@DanWaxman

Copy link
Copy Markdown
Collaborator Author

@DanWaxman sorry to add 1 more thing, but can we add to the existing SDE L63 tutorial that uses a new Discretizer w Cuthbert EnKF and compare the posterior and the compute time to cd-dynamax EnKF?

Sure, done!

@mattlevine22
mattlevine22 merged commit 7992281 into main Aug 18, 2026
3 checks passed
@DanWaxman
DanWaxman deleted the dw-better-discretizers-v2 branch August 24, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants