Skip to content

Commit

Permalink
Merge pull request #178 from JuliaDiff/generic
Browse files Browse the repository at this point in the history
Fix generic-ness and improve inference
  • Loading branch information
ChrisRackauckas authored Dec 29, 2023
2 parents 50ebf92 + 929832e commit 7e4915a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FiniteDiff"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.21.1"
version = "2.22.0"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
2 changes: 1 addition & 1 deletion src/epsilons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end
return eps(T)
end

default_relstep(v::Type, T) = default_relstep(v(), T)
default_relstep(::Type{V}, T) where V = default_relstep(V(), T)
@inline function default_relstep(::Val{fdtype}, ::Type{T}) where {fdtype,T<:Number}
if fdtype==:forward
return sqrt(eps(real(T)))
Expand Down
2 changes: 1 addition & 1 deletion src/jacobians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function finite_difference_jacobian(
x_save = ArrayInterface.allowed_getindex(vecx, i)
epsilon = compute_epsilon(Val(:forward), x_save, relstep, absstep, dir)
_vecx1 = setindex(vecx, x_save+epsilon, i)
_x1 = reshape(_vecx1, axes(x))
_x1 = ArrayInterface.restructure(x,_vecx1)
vecfx1 = _vec(f(_x1))
dx = (vecfx1-vecfx) / epsilon
return dx
Expand Down

0 comments on commit 7e4915a

Please sign in to comment.