diff --git a/ext/IntegralsArblibExt.jl b/ext/IntegralsArblibExt.jl index 1c4356b4..37811bd7 100644 --- a/ext/IntegralsArblibExt.jl +++ b/ext/IntegralsArblibExt.jl @@ -16,18 +16,23 @@ function Integrals.__solvebp_call(prob::IntegralProblem, alg::ArblibJL, sensealg if isinplace(prob) res = Acb(0) y_ = similar(prob.f.integrand_prototype, typeof(res)) - f_ = (y, x; kws...) -> Arblib.set!(y, only(prob.f(y_, x, p; kws...))) + f_ = (y, x; kws...) -> (prob.f(y_, x, p; kws...); Arblib.set!(y, only(y_))) val = Arblib.integrate!(f_, res, lb, ub, atol=abstol, rtol=reltol, check_analytic=alg.check_analytic, take_prec=alg.take_prec, warn_on_no_convergence=alg.warn_on_no_convergence, opts=alg.opts) - SciMLBase.build_solution(prob, alg, val, nothing, retcode = ReturnCode.Success) + SciMLBase.build_solution(prob, alg, val, get_radius(val), retcode = ReturnCode.Success) else f_ = (x; kws...) -> only(prob.f(x, p; kws...)) val = Arblib.integrate(f_, lb, ub, atol=abstol, rtol=reltol, check_analytic=alg.check_analytic, take_prec=alg.take_prec, warn_on_no_convergence=alg.warn_on_no_convergence, opts=alg.opts) - SciMLBase.build_solution(prob, alg, val, nothing, retcode = ReturnCode.Success) + SciMLBase.build_solution(prob, alg, val, get_radius(val), retcode = ReturnCode.Success) end end +function get_radius(ball) + x = abs(midpoint(ball)) + return max(abs(x - abs_ubound(ball)), abs(x - abs_lbound(ball))) +end + end