Skip to content

Commit 9a39c80

Browse files
committed
avoid repetition of build_solution
1 parent 95e27e2 commit 9a39c80

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

ext/IntegralsArblibExt.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ function Integrals.__solvebp_call(
2121
val = Arblib.integrate!(f_, res, lb, ub, atol = abstol, rtol = reltol,
2222
check_analytic = alg.check_analytic, take_prec = alg.take_prec,
2323
warn_on_no_convergence = alg.warn_on_no_convergence, opts = alg.opts)
24-
SciMLBase.build_solution(
25-
prob, alg, val, get_radius(val), retcode = ReturnCode.Success)
2624
else
2725
f_ = (x; kws...) -> only(prob.f(x, p; kws...))
2826
val = Arblib.integrate(f_, lb, ub, atol = abstol, rtol = reltol,
2927
check_analytic = alg.check_analytic, take_prec = alg.take_prec,
3028
warn_on_no_convergence = alg.warn_on_no_convergence, opts = alg.opts)
31-
SciMLBase.build_solution(
32-
prob, alg, val, get_radius(val), retcode = ReturnCode.Success)
3329
end
30+
SciMLBase.build_solution(prob, alg, val, get_radius(val), retcode = ReturnCode.Success)
3431
end
3532

3633
function get_radius(ball)

src/Integrals.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ function __solvebp_call(cache::IntegralCache, alg::QuadGKJL, sensealg, domain, p
156156
end
157157
val, err = quadgk(_f, lb, ub, segbuf = cache.cacheval, maxevals = maxiters,
158158
rtol = reltol, atol = abstol, order = alg.order, norm = alg.norm)
159-
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
160159
else
161160
prototype = f(typeof(mid)[], p)
162161
_f = if prototype isa AbstractVector
@@ -170,7 +169,6 @@ function __solvebp_call(cache::IntegralCache, alg::QuadGKJL, sensealg, domain, p
170169
end
171170
val, err = quadgk(_f, lb, ub, segbuf = cache.cacheval, maxevals = maxiters,
172171
rtol = reltol, atol = abstol, order = alg.order, norm = alg.norm)
173-
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
174172
end
175173
else
176174
if isinplace(f)
@@ -179,14 +177,13 @@ function __solvebp_call(cache::IntegralCache, alg::QuadGKJL, sensealg, domain, p
179177
val, err = quadgk!(_f, result, lb, ub, segbuf = cache.cacheval,
180178
maxevals = maxiters,
181179
rtol = reltol, atol = abstol, order = alg.order, norm = alg.norm)
182-
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
183180
else
184181
_f = u -> f(u, p)
185182
val, err = quadgk(_f, lb, ub, segbuf = cache.cacheval, maxevals = maxiters,
186183
rtol = reltol, atol = abstol, order = alg.order, norm = alg.norm)
187-
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
188184
end
189185
end
186+
SciMLBase.build_solution(prob, alg, val, err, retcode = ReturnCode.Success)
190187
end
191188

192189
function init_cacheval(alg::HCubatureJL, prob::IntegralProblem)

0 commit comments

Comments
 (0)