Integrals.jl icon indicating copy to clipboard operation
Integrals.jl copied to clipboard

Derivative with VEGAS: ERROR: AssertionError: prob.nout == 1

Open KirillZubov opened this issue 4 years ago • 0 comments

using Quadrature, ForwardDiff, FiniteDiff, Zygote, Cuba

f(x,p) = sum(sin.(x .* p))
lb = ones(2)
ub = 3ones(2)
p = [1.5,2.0]
prob = QuadratureProblem(f,lb,ub,p)
solve(prob,VEGAS(),reltol=1e-6,abstol=1e-6,maxiters =1000)[1]

function testf(p)
    prob = QuadratureProblem(f,lb,ub,p)
    sin(solve(prob,VEGAS(),reltol=1e-6,abstol=1e-6,maxiters =1000)[1])
end
dp1 = Zygote.gradient(testf,p)
#julia> ERROR: AssertionError: prob.nout == 1
dp2 = FiniteDiff.finite_difference_gradient(testf,p)
dp3 = ForwardDiff.gradient(testf,p)
#julia> ERROR: AssertionError: prob.nout == 1

KirillZubov avatar Nov 10 '20 10:11 KirillZubov