Skip to content

Give RKV76IIa's k8 and k10 their own storage - #4358

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
singhharsh1708:fix-rkv76iia-aliasing
Aug 26, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
singhharsh1708:fix-rkv76iia-aliasing

Conversation

@singhharsh1708

Copy link
Copy Markdown
Member

RKV76IIa returns garbage in place while the out-of-place path is correct, and it
reports retcode = Success while doing it.

On u'' = -sin(u), u0 = [2.0, 0.0], tspan = (0.0, 20.0), fixed steps, against a
tight Vern9 reference:

in-place      err 1.96e4
out-of-place  err 8.57e-4

On the linear u' = [u2, -u1] over (0, 1) the in-place answers come out around
1e9-1e12 where the exact value is 0.54, with retcode = Success at every
step size.

Cause

lib/OrdinaryDiffEqVerner/src/verner_caches.jl, the RKV76IIa in-place cache:

k3 = k2
k8 = k3
k10 = k4

Vern7Cache has k3 = k2 and allocates the rest. The two extra aliases were added
here, and RKV76IIa's tableau does not permit them: f(k8, ...) overwrites k3,
which stages 9 and 10 then use with a93 = -459.7 and a103 = -493.2, and k10
overwrites k4 while b4 != 0. Vern7 gets away with k3 = k2 because a_i2 == 0
for i >= 4 and b2 == 0; that argument does not extend to the other two.

Fix

Give k8 and k10 their own storage. k3 = k2 is kept -- it is valid here for the
same reason it is valid in Vern7Cache.

After the change the two paths agree to 4.3e-12 across dt = 20/2^5 ... 20/2^9,
and both measure the expected order.

Testing

The RKV76IIa block in lib/OrdinaryDiffEqVerner/test/ode_verner_tests.jl only ran
check_convergence(dts, prob_oop, ...). prob_iip is defined at the top of that
file and was never used, so the in-place path of this method had no coverage at all
-- every other algorithm in the file exercises in-place through probbig.

Added the matching check_convergence(dts, prob_iip, RKV76IIa(), 7) and an explicit
in-place vs out-of-place agreement assertion. Both fail on master and pass here.

Bumps OrdinaryDiffEqVerner one patch from master.

AI Disclosure

Claude assisted with this change.

@ChrisRackauckas

Copy link
Copy Markdown
Member

@singhharsh1708 no retroactive comments.

@ChrisRackauckas
ChrisRackauckas merged commit 025c9a8 into SciML:master Aug 26, 2026
15 of 22 checks passed
@singhharsh1708

singhharsh1708 commented Aug 26, 2026 •

Copy link
Copy Markdown
Member Author

@singhharsh1708 no retroactive comments.

I think it broke one of my rules. I need to fix that. Won’t happen again.

@singhharsh1708
singhharsh1708 deleted the fix-rkv76iia-aliasing branch August 26, 2026 19:04
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