You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia>function MeasureBase.smf(μ::StdNormal, x::Dual{TAG}) where TAG
val = ForwardDiff.value(x)
Δ = ForwardDiff.partials(x)
Dual{TAG}(smf(μ, val), Δ *densityof(μ, val))
end
We should be able to tell ForwardDiff that the derivative of
smf
islogdensityof
. Here are timings for these separately for aStdNormal
:If we compute both, there's no extra overhead, and we even save a little;
It would be good to "teach" ForwardDiff to do this, because it's currently much slower:
I'd think this ought to do it:
But it doesn't:
How can we get this working properly?
It should also work if we call
ForwardDiff.derivative(smf(StdNormal()), x)
The text was updated successfully, but these errors were encountered: