Skip to content

Add dir field to AutoFiniteDiff #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
- `relstep`: relative finite difference step size
- `absstep`: absolute finite difference step size
"""
Base.@kwdef struct AutoFiniteDiff{T1, T2, T3, S1, S2} <: AbstractADType
Base.@kwdef struct AutoFiniteDiff{T1, T2, T3, S1, S2, S3} <: AbstractADType
fdtype::T1 = Val(:forward)
fdjtype::T2 = fdtype
fdhtype::T3 = Val(:hcentral)
relstep::S1 = nothing
absstep::S2 = nothing
dir::S3 = true
end

mode(::AutoFiniteDiff) = ForwardMode()
Expand All @@ -138,6 +139,8 @@ function Base.show(io::IO, backend::AutoFiniteDiff)
print(io, "relstep=", repr(backend.relstep; context = io), ", ")
!isnothing(backend.absstep) &&
print(io, "absstep=", repr(backend.absstep; context = io))
!backend.dir &&
print(io, "dir=", repr(backend.dir; context = io))
print(io, ")")
end

Expand Down