@@ -5,13 +5,13 @@ isdefined(Base, :get_extension) ? (using ForwardDiff) : (using ..ForwardDiff)
5
5
6
6
# Default to direct AD on solvers
7
7
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} }
11
10
if isinplace (cache. f)
12
11
prototype = cache. f. integrand_prototype
13
12
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" ))
15
15
dprototype = similar (prototype, replace_dualvaltype (D, elt))
16
16
df = if cache. f isa BatchIntegralFunction
17
17
BatchIntegralFunction {true} (cache. f. f, dprototype)
@@ -20,20 +20,21 @@ function Integrals.__solvebp(cache, alg, sensealg, domain,
20
20
end
21
21
prob = Integrals. build_problem (cache)
22
22
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... )
24
25
Integrals. __solvebp_call (dcache, alg, sensealg, domain, p; kwargs... )
25
26
else
26
27
Integrals. __solvebp_call (cache, alg, sensealg, domain, p; kwargs... )
27
28
end
28
29
end
29
30
30
-
31
31
# TODO : add the pushforward for derivative w.r.t lb, and ub (and then combinations?)
32
32
33
33
# 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} }
37
38
38
39
# we need the output type to avoid perturbation confusion while unwrapping nested duals
39
40
# We compute a vector-valued integral of the primal and dual simultaneously
0 commit comments