Skip to content

Commit 7e4915a

Browse files
authoredDec 29, 2023
Merge pull request #178 from JuliaDiff/generic
Fix generic-ness and improve inference
2 parents 50ebf92 + 929832e commit 7e4915a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

‎Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FiniteDiff"
22
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
3-
version = "2.21.1"
3+
version = "2.22.0"
44

55
[deps]
66
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

‎src/epsilons.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ end
2222
return eps(T)
2323
end
2424

25-
default_relstep(v::Type, T) = default_relstep(v(), T)
25+
default_relstep(::Type{V}, T) where V = default_relstep(V(), T)
2626
@inline function default_relstep(::Val{fdtype}, ::Type{T}) where {fdtype,T<:Number}
2727
if fdtype==:forward
2828
return sqrt(eps(real(T)))

‎src/jacobians.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function finite_difference_jacobian(
194194
x_save = ArrayInterface.allowed_getindex(vecx, i)
195195
epsilon = compute_epsilon(Val(:forward), x_save, relstep, absstep, dir)
196196
_vecx1 = setindex(vecx, x_save+epsilon, i)
197-
_x1 = reshape(_vecx1, axes(x))
197+
_x1 = ArrayInterface.restructure(x,_vecx1)
198198
vecfx1 = _vec(f(_x1))
199199
dx = (vecfx1-vecfx) / epsilon
200200
return dx

0 commit comments

Comments
 (0)