Skip to content

Commit 7d51ca3

Browse files
fix inplace dispatching
1 parent 08c949f commit 7d51ca3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/jacobians.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
function finite_difference_jacobian(f, x::AbstractArray{<:Number},
33
fdtype::DataType=Val{:central}, funtype::DataType=Val{:Real},
44
wrappertype::DataType=Val{:Default},
5-
fx::Union{Void,AbstractArray{<:Number}}=nothing, epsilon::Union{Void,AbstractArray{<:Real}}=nothing, returntype=eltype(x),
5+
fx::Union{Void,AbstractArray{<:Number}}=nothing,
6+
epsilon::Union{Void,AbstractArray{<:Number}}=nothing, returntype=eltype(x),
67
inplace::DataType=Val{true})
7-
88
J = zeros(returntype, length(x), length(x))
99
finite_difference_jacobian!(J, f, x, fdtype, funtype, wrappertype, fx,
10-
epsilon, returntype,inplace)
10+
epsilon, returntype, inplace)
1111
end
1212

1313
function finite_difference_jacobian!(J::AbstractMatrix{<:Number}, f,
@@ -18,14 +18,14 @@ function finite_difference_jacobian!(J::AbstractMatrix{<:Number}, f,
1818
epsilon::Union{Void,AbstractArray{<:Number}}=nothing, returntype=eltype(x),
1919
inplace::DataType=Val{true})
2020

21-
finite_difference_jacobian!(J, f, x, fdtype, funtype, wrappertype, fx,
21+
_finite_difference_jacobian!(J, f, x, fdtype, funtype, wrappertype, fx,
2222
epsilon, returntype, inplace)
2323
end
2424

25-
function finite_difference_jacobian!(J::AbstractMatrix{<:Real}, f,
25+
function _finite_difference_jacobian!(J::AbstractMatrix{<:Real}, f,
2626
x::AbstractArray{<:Real},
2727
fdtype::DataType, ::Type{Val{:Real}}, ::Type{Val{:Default}},
28-
fx, epsilon, returntype=eltype(x), inplace::Type{Val{true}})
28+
fx, epsilon, returntype, inplace::Type{Val{true}})
2929

3030
# TODO: test and rework this to support GPUArrays and non-indexable types, if possible
3131
m, n = size(J)
@@ -68,7 +68,7 @@ function finite_difference_jacobian!(J::AbstractMatrix{<:Real}, f,
6868
J
6969
end
7070

71-
function finite_difference_jacobian!(J::AbstractMatrix{<:Number}, f,
71+
function _finite_difference_jacobian!(J::AbstractMatrix{<:Number}, f,
7272
x::AbstractArray{<:Number},
7373
fdtype::DataType, ::Type{Val{:Complex}}, ::Type{Val{:Default}},
7474
fx, epsilon, returntype, inplace::Type{Val{true}})

0 commit comments

Comments
 (0)