Skip to content

Commit d6c90ce

Browse files
committed
Rename FiniteDifferenceMethod
1 parent 6abb61d commit d6c90ce

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/methods.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ mutable struct History
4848
end
4949

5050
"""
51-
FiniteDifferencesethod
51+
FiniteDifferenceMethod
5252
5353
Abstract type for all finite differencing method types.
54-
Subtypes of `FiniteDifferencesethod` are callable with the signature
54+
Subtypes of `FiniteDifferenceMethod` are callable with the signature
5555
5656
```
5757
method(f, x; kwargs...)
@@ -64,10 +64,10 @@ where the keyword arguments can be any of
6464
* `condition`: The condition number. See [`DEFAULT_CONDITION`](@ref).
6565
* `eps`: The assumed roundoff error. Defaults to `eps()` plus [`TINY`](@ref).
6666
"""
67-
abstract type FiniteDifferencesethod end
67+
abstract type FiniteDifferenceMethod end
6868

69-
function Base.show(io::IO, x::FiniteDifferencesethod)
70-
@printf io "FiniteDifferencesethod:\n"
69+
function Base.show(io::IO, x::FiniteDifferenceMethod)
70+
@printf io "FiniteDifferenceMethod:\n"
7171
@printf io " order of method: %d\n" x.p
7272
@printf io " order of derivative: %d\n" x.q
7373
@printf io " grid: %s\n" x.grid
@@ -83,7 +83,7 @@ end
8383

8484
for D in (:Forward, :Backward, :Central, :Nonstandard)
8585
@eval begin
86-
struct $D{G<:AbstractVector, C<:AbstractVector} <: FiniteDifferencesethod
86+
struct $D{G<:AbstractVector, C<:AbstractVector} <: FiniteDifferenceMethod
8787
p::Int
8888
q::Int
8989
grid::G
@@ -121,7 +121,7 @@ for D in (:Forward, :Backward, :Central)
121121
122122
Construct a $($lcname) finite difference method of order `p` to compute the `q`th
123123
derivative.
124-
See [`FiniteDifferencesethod`](@ref) for more details.
124+
See [`FiniteDifferenceMethod`](@ref) for more details.
125125
"""
126126
($D, $fdmf)
127127
end
@@ -133,7 +133,7 @@ end
133133
An finite differencing method which is constructed based on a user-defined grid. It is
134134
nonstandard in the sense that it represents neither forward, backward, nor central
135135
differencing.
136-
See [`FiniteDifferencesethod`](@ref) for further details.
136+
See [`FiniteDifferenceMethod`](@ref) for further details.
137137
"""
138138
function Nonstandard(grid::AbstractVector{<:Real}, q::Integer; adapt=0, kwargs...)
139139
p = length(grid)
@@ -166,8 +166,8 @@ end
166166
_estimate_bound(x, cond) = cond * maximum(abs, x) + TINY
167167

168168
"""
169-
fdm(m::FiniteDifferencesethod, f, x[, Val(false)]; kwargs...) -> Real
170-
fdm(m::FiniteDifferencesethod, f, x, Val(true); kwargs...) -> Tuple{FiniteDifferencesethod, Real}
169+
fdm(m::FiniteDifferenceMethod, f, x[, Val(false)]; kwargs...) -> Real
170+
fdm(m::FiniteDifferenceMethod, f, x, Val(true); kwargs...) -> Tuple{FiniteDifferenceMethod, Real}
171171
172172
Compute the derivative of `f` at `x` using the finite differencing method `m`.
173173
The optional `Val` argument dictates whether the method should be returned alongside the
@@ -186,7 +186,7 @@ The recognized keywords are:
186186
`adapt` greater than 0 when `m::Nonstandard` results in an error.
187187
188188
!!! note
189-
Calling [`FiniteDifferencesethod`](@ref) objects is equivalent to passing them to `fdm`.
189+
Calling [`FiniteDifferenceMethod`](@ref) objects is equivalent to passing them to `fdm`.
190190
191191
# Examples
192192
@@ -195,7 +195,7 @@ julia> fdm(central_fdm(5, 1), sin, 1; adapt=2)
195195
0.5403023058681039
196196
197197
julia> fdm(central_fdm(2, 1), exp, 0, Val(true))
198-
(FiniteDifferencesethod:
198+
(FiniteDifferenceMethod:
199199
order of method: 2
200200
order of derivative: 1
201201
grid: [-1, 1]
@@ -217,7 +217,7 @@ function fdm(
217217
eps=(Base.eps(float(bound)) + TINY),
218218
adapt=m.history.adapt,
219219
max_step=0.1,
220-
) where M<:FiniteDifferencesethod
220+
) where M<:FiniteDifferenceMethod
221221
if M <: Nonstandard && adapt > 0
222222
throw(ArgumentError("can't adaptively compute bounds over Nonstandard grids"))
223223
end
@@ -265,7 +265,7 @@ function fdm(
265265
return m, dfdx
266266
end
267267

268-
function fdm(m::FiniteDifferencesethod, f, x, ::Val{false}=Val(false); kwargs...)
268+
function fdm(m::FiniteDifferenceMethod, f, x, ::Val{false}=Val(false); kwargs...)
269269
_, dfdx = fdm(m, f, x, Val(true); kwargs...)
270270
return dfdx
271271
end

test/methods.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ using FiniteDifferences: Forward, Backward, Central, Nonstandard
2525
@test central_fdm(5, 1)(abs, 0.001) 1.0
2626
end
2727

28-
@testset "Printing FiniteDifferencesethods" begin
28+
@testset "Printing FiniteDifferenceMethods" begin
2929
@test sprint(show, central_fdm(2, 1)) == """
30-
FiniteDifferencesethod:
30+
FiniteDifferenceMethod:
3131
order of method: 2
3232
order of derivative: 1
3333
grid: [-1, 1]
@@ -39,7 +39,7 @@ using FiniteDifferences: Forward, Backward, Central, Nonstandard
3939
regex_array = r"\[([\d.+-e]+(, )?)+\]"
4040
@test occursin(Regex(join(map(x -> x.pattern,
4141
[
42-
r"FiniteDifferencesethod:",
42+
r"FiniteDifferenceMethod:",
4343
r"order of method:", r"\d+",
4444
r"order of derivative:", r"\d+",
4545
r"grid:", regex_array,

0 commit comments

Comments
 (0)