Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huanglangwen opened this issue Mar 26, 2019 · 2 comments
Closed

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

huanglangwen opened this issue Mar 26, 2019 · 2 comments

Comments

@huanglangwen
Copy link
Contributor

huanglangwen commented Mar 26, 2019

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
@ChrisRackauckas
Copy link
Member

Yeah, that's quite an omission from the README. Thanks for pointing it out!

@ChrisRackauckas
Copy link
Member

added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants