Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/monotonic/monotonic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ end
size(A::MonotonicInterpolation) = size(A.knots)
axes(A::MonotonicInterpolation) = axes(A.knots)

itpflag(A::MonotonicInterpolation) = A.it

function MonotonicInterpolation(::Type{TWeights}, it::TInterpolationType, knots::TKnots, A::AbstractArray{TEl,1},
m::Vector{TCoeffs}, c::Vector{TCoeffs}, d::Vector{TCoeffs}) where {TWeights, TCoeffs, TEl, TInterpolationType<:MonotonicInterpolationType, TKnots<:AbstractVector{<:Number}}

Expand Down
15 changes: 15 additions & 0 deletions test/monotonic/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ using Interpolations
end
end
end
extFlatItp = extrapolate(itp, Flat())
@test extFlatItp(x[1]-1) ≈ itp(x[1])
@test extFlatItp(x[end]+1) ≈ itp(x[end])
extThrowItp = extrapolate(itp, Throw())
@test_throws BoundsError extThrowItp(x[1]-1)
@test_throws BoundsError extThrowItp(x[end]+1)
extLineItp = extrapolate(itp, Line())
@test extLineItp(x[1]-1) ≈ itp(x[1]) - Interpolations.gradient1(itp, x[1])
@test extLineItp(x[end]+1) ≈ itp(x[end]) + Interpolations.gradient1(itp, x[end])
extReflectItp = extrapolate(itp, Reflect())
@test extReflectItp(x[1]-0.1) ≈ itp(x[1]+0.1)
@test extReflectItp(x[end]+0.1) ≈ itp(x[end]-0.1)
extPeriodicItp = extrapolate(itp, Periodic())
@test extPeriodicItp(x[1]-0.1) ≈ itp(x[end]-0.1)
@test extPeriodicItp(x[end]+0.1) ≈ itp(x[1]+0.1)
end
end

Expand Down