Skip to content

Fix FSAL out-of-place controlled stepping - #110

Open
trestoncuzzort wants to merge 1 commit into
boostorg:developfrom
trestoncuzzort:fix-fsal-out-of-place-step
Open

trestoncuzzort wants to merge 1 commit into
boostorg:developfrom
trestoncuzzort:fix-fsal-out-of-place-step

Conversation

@trestoncuzzort

Copy link
Copy Markdown

The FSAL overload try_step(system, in, t, out, dt) does not compile: it forwards six arguments to an overload that needs seven.

Use the existing, resized proposal-derivative buffer and copy it into the cached derivative after an accepted step. The error checker sees the derivative at the start of the attempt, and rejected attempts retain that derivative for a retry. The proposed output state remains available after an error rejection.

The new regression covers array/vector states, accepted and rejected attempts, retries, both time directions, reset, explicit initialization, copying, dynamic resizing, and rejection by the maximum-step limit. It checks derivative values and RHS call counts against the existing explicit-derivative API. A one-line fix that aliases input and output derivatives compiles but fails 260 regression checks.

Validation:

  • Full native B2 suite: GCC 16/C++14 passes 69 checks and 64 runtime programs; Clang 23/C++17 passes 67 checks and 62 runtime programs.
  • The new B2 regression binaries pass explicit Valgrind checks with zero errors. The regression and trajectory comparison also pass with ASan/UBSan.
  • A grid of 4,200 trajectories using the default error checker passes 534,980 comparisons against the existing in-place API and the explicit-derivative API with a freshly computed starting derivative.
  • Pinned Linux GCC 11, Linux Clang with sanitizers, macOS and Windows MSVC checks reproduce the original compile failure, reject the derivative-alias control, and pass the fixed regression and trajectory grid.

The broader explicit Valgrind baseline reports pre-existing findings in eight GCC programs and eleven Clang programs. All 124 pre-existing test executables are byte-for-byte identical after this patch; the two new regression binaries were checked separately.

Fixes #72.

Keep the proposed derivative separate during error checking and rejected attempts. Update the cached derivative only after an accepted step.

Fixes boostorg#72.

Generated-by: Codex
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.

Version 2 of controlled_runge_kutta::try_step for FSAL steppers does not compile

1 participant