diff --git a/Project.toml b/Project.toml index a5b0cdc..ee8e439 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InfinitesimalGenerators" uuid = "2fce0c6f-5f0b-5c85-85c9-2ffe1d5ee30d" -version = "2.2.0" +version = "2.3.0" [deps] Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" diff --git a/src/derivatives.jl b/src/derivatives.jl index 72fff1a..1d71a46 100644 --- a/src/derivatives.jl +++ b/src/derivatives.jl @@ -1,4 +1,4 @@ - +# bc corresponds to value of first derivative outside the grid. Default to (0, 0), which corresponds to reflecting. struct FirstDerivative{T, X <: AbstractVector{<:Real}, Y <: AbstractVector{<: Real}} <: AbstractVector{T} x::X y::Y @@ -7,12 +7,12 @@ struct FirstDerivative{T, X <: AbstractVector{<:Real}, Y <: AbstractVector{<: Re function FirstDerivative(x, y, bc, direction) size(x) == size(y) || throw(DimensionMismatch( "cannot match grid of length $(length(x)) with vector of length $(length(y))")) - direction ∈ (:upward, :downward) || throw(ArgumentError("direction must be :upward or :downward")) + direction ∈ (:forward, :backward) || throw(ArgumentError("direction must be :forward or :backward")) return new{float(eltype(y)), typeof(x), typeof(y)}(x, y, bc, direction) end end -FirstDerivative(x, y; bc = (0, 0), direction = :upward) = FirstDerivative(x, y, bc, direction) +FirstDerivative(x, y; bc = (0, 0), direction = :forward) = FirstDerivative(x, y, bc, direction) Base.size(d::FirstDerivative) = (length(d.x), 1) @@ -20,7 +20,7 @@ Base.IndexStyle(d::FirstDerivative) = IndexLinear() function Base.getindex(d::FirstDerivative{T}, i::Int) where {T} x, y, bc, direction = d.x, d.y, d.bc, d.direction - if direction == :upward + if direction == :forward if i == length(x) return convert(T, bc[end]) else