Skip to content

No mention of the form of "f" in the README #49

Closed
@huanglangwen

Description

@huanglangwen

I ran into an error when using the inplace jacobian. I later discovered that's due to the function have to be in the form of (fx,x)->(fx=f(x)). I think this should be mentioned on the document.

julia> using DiffEqDiffTools
julia> jac_cache=DiffEqDiffTools.JacobianCache(zeros(2),Val{:forward})
julia> J=zeros((2,2))
julia> DiffEqDiffTools.finite_difference_jacobian!(J,x->(x.=x.+1;x),[0.,0.],jac_cache)

ERROR: MethodError: no method matching (::getfield(Main, Symbol("##3#4")))(::Array{Flo
at64,1}, ::Array{Float64,1})
Closest candidates are:
  #3(::Any) at REPL[4]:1
Stacktrace:
 [1] finite_difference_jacobian!(::Array{Float64,2}, ::getfield(Main, Symbol("##3#4"))
, ::Array{Float64,1}, ::DiffEqDiffTools.JacobianCache{Array{Float64,1},Array{Float64,1
},Array{Float64,1},Val{:forward},Float64,Val{true}}, ::Nothing) at /root/.julia/packag
es/DiffEqDiffTools/bzjuh/src/jacobians.jl:121
 [2] finite_difference_jacobian!(::Array{Float64,2}, ::Function, ::Array{Float64,1}, :
:DiffEqDiffTools.JacobianCache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Val{
:forward},Float64,Val{true}}) at /root/.julia/packages/DiffEqDiffTools/bzjuh/src/jacob
ians.jl:109
 [3] top-level scope at none:0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions