Skip to content

Commit b45bfcf

Browse files
author
Roger-luo
committed
Merge branch 'roger/multiargs' of https://github.com/Roger-luo/FDM.jl into roger/multiargs
2 parents 4d22ce2 + 4da0e25 commit b45bfcf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/grad.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Approximate the gradient of `f` at `xs...` using `fdm`. Assumes that `f(xs...)`
99
function grad end
1010

1111
function grad(fdm, f, x::AbstractArray{T}) where T
12-
dx, tmp = similar(x), similar(x)
12+
dx = similar(x)
13+
tmp = similar(x)
1314
for k in eachindex(x)
1415
dx[k] = fdm(zero(T)) do ϵ
1516
tmp .= x
@@ -43,7 +44,7 @@ function grad(fdm, f, xs...)
4344
end
4445

4546
"""
46-
jacobian(fdm, f, xs::Union{Real, AbstractArray{<:Real}}[; dim::Int=length(f(x))])
47+
jacobian(fdm, f, xs::Union{Real, AbstractArray{<:Real}}; dim::Int=length(f(x)))
4748
4849
Approximate the Jacobian of `f` at `x` using `fdm`. `f(x)` must be a length `D` vector. If
4950
`D` is not provided, then `f(x)` is computed once to determine the output size.

0 commit comments

Comments
 (0)