From d31d068e622225d14d449fe46b7bb8cc384412df Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Tue, 5 May 2026 10:41:33 -0400 Subject: [PATCH 1/2] test(reduction): use sol.u[end] instead of last(sol) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under SciMLBase v3, `last(sol)` for a 1-component ODE returns a `Float64` scalar rather than a 1-element `Vector{Float64}`. With the existing `output_func`, that flowed through to: - `sim1.u :: Vector{Float64}` (was Vector{Vector{Float64}}) - `sum(sim1.u) :: Float64` (was Vector{Float64}) - `sim2.u :: Vector{Float64}` (1-element, from `u_init = [0.0]`) making `@test sum(sim1.u) ≈ sim2.u` fail with: MethodError: no method matching isapprox(::Float64, ::Vector{Float64}) i.e. the test wasn't migrated correctly when the rest of the suite moved to SciMLBase v3 / RecursiveArrayTools v4. Switching to `sol.u[end]` keeps each per-trajectory output as a state vector, restoring the original shape semantics so the three existing assertions hold without relaxing what they check. Verified locally with `GROUP=JLArrays`: Test Summary: | Pass Total Time Reduction | 3 3 24.1s Co-Authored-By: Chris Rackauckas --- test/reduction.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/reduction.jl b/test/reduction.jl index 391c5b07..94f41809 100644 --- a/test/reduction.jl +++ b/test/reduction.jl @@ -14,7 +14,11 @@ end prob = ODEProblem(f!, [0.5], (0.0, 1.0)) function output_func(sol, ctx) - return last(sol), false + # Use `sol.u[end]` rather than `last(sol)` so each per-trajectory output + # stays a state vector. In SciMLBase v3, `last(sol)` returns a scalar for + # single-component ODEs, which makes `sum(sim1.u)` a scalar and breaks the + # comparison against `sim2.u` (a 1-element vector from `u_init = [0.0]`). + return sol.u[end], false end function prob_func(prob, ctx) From 326a67991bd895e45d12d9d04d76e8ab4ecfd120 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 5 May 2026 14:45:24 +0000 Subject: [PATCH 2/2] Apply suggestion from @ChrisRackauckas --- test/reduction.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/reduction.jl b/test/reduction.jl index 94f41809..d8faaa34 100644 --- a/test/reduction.jl +++ b/test/reduction.jl @@ -14,10 +14,6 @@ end prob = ODEProblem(f!, [0.5], (0.0, 1.0)) function output_func(sol, ctx) - # Use `sol.u[end]` rather than `last(sol)` so each per-trajectory output - # stays a state vector. In SciMLBase v3, `last(sol)` returns a scalar for - # single-component ODEs, which makes `sum(sim1.u)` a scalar and breaks the - # comparison against `sim2.u` (a 1-element vector from `u_init = [0.0]`). return sol.u[end], false end