Skip to content

Commit 318ebc8

Browse files
committed
check_gridded now enforces unique knots
1 parent 3b2825a commit 318ebc8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/gridded/gridded.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
end
4949
degree(flag) isa Union{NoInterp,Constant,Linear} || error("only Linear, Constant, and NoInterp supported, got $flag")
5050
length(k1) == 1 && error("dimensions of length 1 not yet supported") # FIXME
51-
issorted(k1) || error("knot-vectors must be sorted in increasing order")
51+
issorted(k1) && allunique(k1) || error("knot-vectors must be unique and sorted in increasing order")
5252
check_gridded(getrest(itpflag), Base.tail(knots), Base.tail(axs))
5353
end
5454
check_gridded(::Any, ::Tuple{}, ::Tuple{}) = nothing

test/gridded/gridded.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,8 @@ using Interpolations, Test
8888

8989
# trailing 1s, issue #301
9090
@test itp(1.8, 1) == itp(1.8)
91+
92+
# issue #395
93+
knots = ([0.0,0.0,1.0],) # not unique
94+
@test_throws ErrorException interpolate(knots, [1.0, 1.0, 2.0], Gridded(Linear()))
9195
end

0 commit comments

Comments
 (0)