Skip to content

Commit 02dc431

Browse files
Add dts and stats also for BVProblem and NonlinearProblem
1 parent b57e938 commit 02dc431

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/benchmark.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ function WorkPrecision(prob::AbstractBVProblem, alg, abstols, reltols, dts = not
285285
N = length(abstols)
286286
errors = Vector{Float64}(undef, N)
287287
times = Vector{Float64}(undef, N)
288+
stats = Vector{Any}(undef, N)
288289
if name === nothing
289290
name = "WP-Alg"
290291
end
@@ -312,6 +313,8 @@ function WorkPrecision(prob::AbstractBVProblem, alg, abstols, reltols, dts = not
312313
dense_errors = dense_errors)
313314
end
314315

316+
stats[i] = sol.stats
317+
315318
if haskey(kwargs, :prob_choice)
316319
cur_appxsol = appxsol[kwargs[:prob_choice]]
317320
elseif prob isa AbstractArray
@@ -372,14 +375,15 @@ function WorkPrecision(prob::AbstractBVProblem, alg, abstols, reltols, dts = not
372375
end
373376
end
374377
end
375-
return WorkPrecision(prob, abstols, reltols, errors, times, name, N)
378+
return WorkPrecision(prob, abstols, reltols, errors, times, dts, stats, name, N)
376379
end
377380

378381
# Work precision information for a nonlinear problem.
379382
function WorkPrecision(prob::NonlinearProblem, alg, abstols, reltols, dts = nothing; name = nothing, appxsol = nothing, error_estimate = :l2, numruns = 20, seconds = 2, kwargs...)
380383
N = length(abstols)
381384
errors = Vector{Float64}(undef, N)
382385
times = Vector{Float64}(undef, N)
386+
stats = Vector{Any}(undef, N)
383387
if name === nothing
384388
name = "WP-Alg"
385389
end
@@ -396,9 +400,11 @@ function WorkPrecision(prob::NonlinearProblem, alg, abstols, reltols, dts = noth
396400
for i in 1:N
397401
sol = solve(_prob, alg; kwargs..., abstol = abstols[i], reltol = reltols[i])
398402

403+
stats[i] = sol.stats
404+
399405
if error_estimate == :l2
400406
if isnothing(appxsol)
401-
errors[i] = sqrt(sum(abs2, sol.resid))
407+
errors[i] = sqrt(sum(abs2, sol.resid))
402408
else
403409
errors[i] = sqrt(sum(abs2, sol .- appxsol))
404410
end
@@ -424,7 +430,7 @@ function WorkPrecision(prob::NonlinearProblem, alg, abstols, reltols, dts = noth
424430
end
425431
end
426432
end
427-
return WorkPrecision(prob, abstols, reltols, errors, times, name, N)
433+
return WorkPrecision(prob, abstols, reltols, errors, times, dts, stats, name, N)
428434
end
429435

430436
function WorkPrecisionSet(prob,

0 commit comments

Comments
 (0)