File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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...)`
88"""
99function grad end
1010
11- function grad (fdm, f, x:: AbstractArray{T} ) where T
11+ function grad (fdm, f, x:: AbstractArray{T} ) where T <: Number
1212 dx = similar (x)
1313 tmp = similar (x)
1414 for k in eachindex (x)
4949Approximate the Jacobian of `f` at `x` using `fdm`. `f(x)` must be a length `D` vector. If
5050`D` is not provided, then `f(x)` is computed once to determine the output size.
5151"""
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 }
5353 J = Matrix {float(T)} (undef, len, length (x))
5454 for d in 1 : len
5555 gs = grad (fdm, x-> f (x)[d], x)
You can’t perform that action at this time.
0 commit comments