Skip to content

Preserve AD wrappers in Rosenbrock stages - #4101

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/preserve-tracked-rosenbrock-stages
Draft

Preserve AD wrappers in Rosenbrock stages#4101
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/preserve-tracked-rosenbrock-stages

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

  • restore AD storage wrappers after restructuring flat Rosenbrock linear-solve results
  • preserve existing state containers, including ArrayPartition, unless the struct-of-arrays conversion matches the original container type
  • add a ReverseDiff regression that exercises the public init / solve! path

Root cause

The first commit of #3996 (100fe236) replaced the former reshape helper with ArrayInterface.restructure. For an out-of-place ReverseDiff state, that changes a TrackedArray template into a plain Vector{TrackedReal}, and the Rosenbrock stage update later attempts to convert the tracked scalars back to Float64.

The focused reproducer passes at the parent commit (5e3c607) and fails at 100fe236. Converting the restructured result with the public ArrayInterface.aos_to_soa API restores the tracked wrapper. The type guard avoids changing other state-container representations.

Validation

  • GROUP=Core julia +1.10 --project=lib/OrdinaryDiffEqRosenbrock -e 'using Pkg; Pkg.test()'
    • DAE Rosenbrock AD Tests: 16 / 16
    • Rosenbrock AD Tests: 64 / 64
    • Rosenbrock Convergence Tests: 192 / 192
  • whole-repository Runic check passed

Ignore this PR until reviewed by @ChrisRackauckas.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

Doesn't JuliaArrays/ArrayInterface.jl#498 cover this?

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