Skip to content

Commit

Permalink
Merge pull request #201 from lxvm/arblib
Browse files Browse the repository at this point in the history
minor fixes to arblibext
  • Loading branch information
ChrisRackauckas authored Nov 20, 2023
2 parents 1174432 + 9a0be0c commit b91f3da
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ext/IntegralsArblibExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b91f3da

Please sign in to comment.