Skip to content

Add recursivefill! and recursivecopy! for ragged arrays#582

Merged
ChrisRackauckas merged 6 commits intoSciML:masterfrom
JoshuaLampert:recursivefill-raggedarrays
Apr 28, 2026
Merged

Add recursivefill! and recursivecopy! for ragged arrays#582
ChrisRackauckas merged 6 commits intoSciML:masterfrom
JoshuaLampert:recursivefill-raggedarrays

Conversation

@JoshuaLampert
Copy link
Copy Markdown
Contributor

The functions recursivefill! and recursivecopy! were missing for the RecursiveArrayToolsRaggedArrays.jl sublibrary. Previously, the following MWE did not work:

using RecursiveArrayToolsRaggedArrays
using OrdinaryDiffEqTsit5

function rhs!(du, u, p, t)
    du .= u
    return nothing
end

n = 2
left = ones(n)
right = left

u = VectorOfArray([copy(left), copy(right)])

tspan = (0.0, 1.0)
prob = ODEProblem(rhs!, u, tspan)

solver = Tsit5()
kwargs = (; dt=0.1, adaptive=false, save_everystep=false)

sol = solve(prob, solver; kwargs...)

This PR fixes it.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@JoshuaLampert JoshuaLampert marked this pull request as draft April 27, 2026 11:41
@JoshuaLampert
Copy link
Copy Markdown
Contributor Author

I'm testing this PR in JoshuaLampert/SimpleDiscontinuousGalerkin.jl#74, where CI is still failing. I'm investigating.

@JoshuaLampert JoshuaLampert marked this pull request as ready for review April 27, 2026 15:33
@JoshuaLampert
Copy link
Copy Markdown
Contributor Author

With this PR, the tests in https://github.com/JoshuaLampert/SimpleDiscontinuousGalerkin.jl/actions/runs/24992576972/job/73220281516 and the ragged array tests here are now passing. In addition to recursivefill! and recursivecopy! this also fixes mapreduce for nested RaggedVectorOfArray and adds an extension for DiffEqBase.jl, such that the correct ODE_DEFAULT_NORM is used for problems using RaggedVectorOfArray as underlying data structure.
I used Claude to help me write the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is circular: these overloads need to go into DiffEqBase instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Totally fine with me. Do you (or one of your bots) create a PR in DiffEqBase.jl? Please ping me there if there is one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah sorry Mr. Bot is a bit slow right now with all the travel and the big stuff of the recent majors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, no worries. I removed the extension again as this will be handled in DiffEqBase.jl now. So I think this is ready from my side.

@ChrisRackauckas ChrisRackauckas merged commit c888aa7 into SciML:master Apr 28, 2026
33 of 37 checks passed
@JoshuaLampert JoshuaLampert deleted the recursivefill-raggedarrays branch April 28, 2026 15:24
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