Closed jlperla closed 5 years ago
Is there a better way to do
# compute gradient by forward automatic differentiation
function g!(G::Vector, x::Vector)
ForwardDiff.gradient!(G, f, x)
end
function fg!(x::Vector, grad::Vector)
if length(grad) > 0 # gradient of f(x)
g!(grad, x)
end
f(x)
end
Solving for the function and the gradient at the same time?
Resolved at cbe604b1811f3a0e8981baff4c7c1149d4c18b06.
x
from the structure andf
OnceDifferentiable
stored value generic. See https://docs.julialang.org/en/v1/manual/types/#Parametric-Types-1Something like
opt(:LD_LBFGS
algorithm.fdf
?:central
to tests for the central differences.