I did not read about it in any documentation, I just debugged my code in
the repl and found a solution, that works.
But the following code is ugly:
if Pkg.installed("ForwardDiff") < v"0.2"
Dual1 = ForwardDiff.GradientNumber
else
Dual1 = ForwardDiff.Dual
end
"""
Helper function to round the value of an optimization results, but also
simple real values.
"""
round_me(result::Dual1, n=2) = round(ForwardDiff.value(result), n)
round_me(result::Real, n=2) = round(result, n)
round_me(res_vector::Vector, n=2) = [round_me(result, n) for result in
res_vector]
Any hints, how to write this code in a cleaner way?
Uwe
On Tuesday, August 9, 2016 at 1:15:08 PM UTC+2, Kristoffer Carlsson wrote:
>
> I didn't think there were any documentation about GradientNumbers in the
> ForwardDiff documentation hence an implementation detail. Where did you
> read about it?