Skip to content

Commit 8313934

Browse files
format
1 parent 4593763 commit 8313934

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ext/IntegralsForwardDiffExt.jl

+10-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ isdefined(Base, :get_extension) ? (using ForwardDiff) : (using ..ForwardDiff)
55

66
# Default to direct AD on solvers
77
function Integrals.__solvebp(cache, alg, sensealg, domain,
8-
p::Union{D,AbstractArray{<:D}};
9-
kwargs...) where {T, V, P, D<:ForwardDiff.Dual{T, V, P}}
10-
8+
p::Union{D, AbstractArray{<:D}};
9+
kwargs...) where {T, V, P, D <: ForwardDiff.Dual{T, V, P}}
1110
if isinplace(cache.f)
1211
prototype = cache.f.integrand_prototype
1312
elt = eltype(prototype)
14-
ForwardDiff.can_dual(elt) || throw(ArgumentError("ForwardDiff of in-place integrands only supports prototypes with real elements"))
13+
ForwardDiff.can_dual(elt) ||
14+
throw(ArgumentError("ForwardDiff of in-place integrands only supports prototypes with real elements"))
1515
dprototype = similar(prototype, replace_dualvaltype(D, elt))
1616
df = if cache.f isa BatchIntegralFunction
1717
BatchIntegralFunction{true}(cache.f.f, dprototype)
@@ -20,20 +20,21 @@ function Integrals.__solvebp(cache, alg, sensealg, domain,
2020
end
2121
prob = Integrals.build_problem(cache)
2222
dprob = remake(prob, f = df)
23-
dcache = init(dprob, alg; sensealg = sensealg, do_inf_transformation=Val(false), kwargs...)
23+
dcache = init(
24+
dprob, alg; sensealg = sensealg, do_inf_transformation = Val(false), kwargs...)
2425
Integrals.__solvebp_call(dcache, alg, sensealg, domain, p; kwargs...)
2526
else
2627
Integrals.__solvebp_call(cache, alg, sensealg, domain, p; kwargs...)
2728
end
2829
end
2930

30-
3131
# TODO: add the pushforward for derivative w.r.t lb, and ub (and then combinations?)
3232

3333
# Manually split for the pushforward
34-
function Integrals.__solvebp(cache, alg::Integrals.AbstractIntegralCExtensionAlgorithm, sensealg, domain,
35-
p::Union{D,AbstractArray{<:D}};
36-
kwargs...) where {T, V, P, D<:ForwardDiff.Dual{T, V, P}}
34+
function Integrals.__solvebp(
35+
cache, alg::Integrals.AbstractIntegralCExtensionAlgorithm, sensealg, domain,
36+
p::Union{D, AbstractArray{<:D}};
37+
kwargs...) where {T, V, P, D <: ForwardDiff.Dual{T, V, P}}
3738

3839
# we need the output type to avoid perturbation confusion while unwrapping nested duals
3940
# We compute a vector-valued integral of the primal and dual simultaneously

0 commit comments

Comments
 (0)