ubcecon / computing_and_datascience

Sandbox and workspace for computing and datascience infrastructure and course materials.
MIT License
8 stars 12 forks source link

Changes to the NLSolverseBase #91

Closed jlperla closed 5 years ago

jlperla commented 5 years ago
jlperla commented 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?

chiyahn commented 5 years ago

Resolved at cbe604b1811f3a0e8981baff4c7c1149d4c18b06.