Skip to content

Commit

Permalink
update FDDerivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
omalled committed Jun 2, 2019
1 parent 250dd65 commit e403ea7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/FDDerivatives.jl
@@ -1,5 +1,8 @@
module FDDerivatives

import Distributed
import LinearAlgebra

"Create Jacobian function"
function makejacobian(f::Function, h::Float64=sqrt(eps(Float64)))
function jacobian(x::Vector)
Expand All @@ -14,7 +17,7 @@ function makejacobian(f::Function, h::Float64=sqrt(eps(Float64)))
for i = 1:length(x)
J[:, i] = ys[i] - ys[end]
end
scale!(J, 1 / h)
LinearAlgebra.lmul!(1 / h, J)
return J
end
end
Expand All @@ -33,7 +36,7 @@ function makegradient(f::Function, h::Float64=sqrt(eps(Float64)))
for i = 1:length(x)
grad[i] = ys[i] - ys[end]
end
scale!(grad, 1 / h)
LinearAlgebra.lmul!(1 / h, grad)
return grad
end
end
Expand Down

2 comments on commit e403ea7

@montyvesselinov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: File Project.toml not found

Please sign in to comment.