File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ Approximate the gradient of `f` at `xs...` using `fdm`. Assumes that `f(xs...)`
8
8
"""
9
9
function grad end
10
10
11
- function grad (fdm, f, x:: AbstractArray{T} ) where T
11
+ function grad (fdm, f, x:: AbstractArray{T} ) where T <: Number
12
12
dx = similar (x)
13
13
tmp = similar (x)
14
14
for k in eachindex (x)
49
49
Approximate the Jacobian of `f` at `x` using `fdm`. `f(x)` must be a length `D` vector. If
50
50
`D` is not provided, then `f(x)` is computed once to determine the output size.
51
51
"""
52
- function jacobian (fdm, f, x:: Union{T, AbstractArray{T}} ; len:: Int = length (f (x))) where {T <: Real }
52
+ function jacobian (fdm, f, x:: Union{T, AbstractArray{T}} ; len:: Int = length (f (x))) where {T <: Number }
53
53
J = Matrix {float(T)} (undef, len, length (x))
54
54
for d in 1 : len
55
55
gs = grad (fdm, x-> f (x)[d], x)
You can’t perform that action at this time.
0 commit comments