Skip to content

Fix weak Platen methods for scalar Wiener processes - #4413

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/pl1wm-scalar-noise
Aug 28, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/pl1wm-scalar-noise

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed and why

The mutable-cache implementations of PL1WM and PL1WMA treated a scalar Wiener increment as a mutable array. PL1WM also wrote scalar-noise stage states into the entire Vector{u} cache and then passed that container to the diffusion function instead of its sole state.

Use the scalar random-variable helper and elementwise state updates when W.dW is a number. Keep the existing mutating helpers for array-valued increments, and index the sole Yp/Ym state on the scalar-noise path. The regression tests cover multiplicative PL1WM and additive PL1WMA solves with an explicit scalar WienerProcess.

Verification

Failing before the fix

With the scalar-Wiener regression test added and the implementation unchanged:

$ GROUP=WeakAdaptiveCPU julia +1.11.9 --project=lib/StochasticDiffEqWeak -e 'using Pkg; Pkg.test()'
Test Summary:     | Pass  Total     Time
CPU Weak adaptive |    6      6  7m10.5s
CPU Weak adaptive step size Brusselator: Error During Test
  LoadError: MethodError: no method matching fill!(::Float64, ::Float64)
  ...
  [2] perform_step!(..., cache::StochasticDiffEqWeak.PL1WMCache...)
      @ StochasticDiffEqWeak .../perform_step/srk_weak.jl:1059
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

Passing after the fix

$ GROUP=WeakAdaptiveCPU julia +1.11.9 --project=lib/StochasticDiffEqWeak -e 'using Pkg; Pkg.test()'
Test Summary:     | Pass  Total     Time
CPU Weak adaptive |    6      6  4m12.6s
Test Summary:                           | Pass  Total   Time
CPU Weak adaptive step size Brusselator |    3      3  23.7s
Testing StochasticDiffEqWeak tests passed

$ GROUP=WeakConvergence1 julia +1.11.9 --project=lib/StochasticDiffEqWeak -e 'using Pkg; Pkg.test()'
Test Summary:                    | Pass  Total     Time
Platen's PL1WM weak second order |   10     10  6m20.6s
Testing StochasticDiffEqWeak tests passed

$ GROUP=Core julia +1.11.9 --project=lib/StochasticDiffEqWeak -e 'using Pkg; Pkg.test()'
Test Summary:                 | Pass  Total  Time
Module loads and constructors |   23     23  6.4s
Testing StochasticDiffEqWeak tests passed

$ GROUP=QA julia +1.11.9 --project=lib/StochasticDiffEqWeak -e 'using Pkg; Pkg.test()'
Test Summary:     | Pass  Broken  Total     Time
QA (Aqua and JET) |   17       4     21  2m01.1s
Testing StochasticDiffEqWeak tests passed

$ julia +1.11.9 --project=.validation/runic-env -e 'using Runic; exit(Runic.main(ARGS))' -- --check lib/StochasticDiffEqWeak/src/perform_step/srk_weak.jl lib/StochasticDiffEqWeak/test/adaptive/sde_weak_brusselator_adaptive.jl
# exit 0

$ typos --format brief lib/StochasticDiffEqWeak/src/perform_step/srk_weak.jl lib/StochasticDiffEqWeak/test/adaptive/sde_weak_brusselator_adaptive.jl
# exit 0

Documentation was not built because this changes no public API or documentation. GPU paths were not tested; the affected regression uses the CPU mutable-cache path.

🤖 Generated with Claude Code

https://chatgpt.com/codex/tasks/01a03a17-ad6f-7131-82fc-d0fd57ea6512

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 28, 2026 07:45
@ChrisRackauckas
ChrisRackauckas merged commit 492022b into SciML:master Aug 28, 2026
145 of 153 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
- Fix definite assignment in ROCK stages (#4321)
- Correct NonlinearSolve downgrade dependency floors (#4394)
- Fix ensemble work-precision error storage (#4390)
- Add explicit benchmark tag semantics (#4402)
- fix: require cache-aware nonlinear solver in PDIRK (#4406)
- fix: accept SciML caches in nlsolve! (#4407)
- Support generic callback event storage (#4398)
- test: account for Hairer4 BLAS variation (#4410)
- Fix Rosenbrock interpolation after callback truncation (#4411)
- Fix weak Platen methods for scalar Wiener processes (#4413)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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