Skip to content

Commit ac165aa

Browse files
committed
fix type inference of chebyshev points
1 parent 5896276 commit ac165aa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/chebyshevtransform.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ end
119119

120120

121121
# Matrix inputs
122-
#
122+
#
123123
#
124124
# function chebyshevtransform!(X::AbstractMatrix{T}; kind::Integer=1) where T<:fftwNumber
125125
# if kind == 1
@@ -296,6 +296,8 @@ function chebyshevpoints(::Type{T}, n::Integer; kind::Int=1) where T<:Number
296296
else
297297
T[cospi(k/(n-one(T))) for k=0:n-1]
298298
end
299+
else
300+
throw(ArgumentError("kind $kind not a valid kind of Chebyshev points"))
299301
end
300302
end
301303
chebyshevpoints(n::Integer; kind::Int=1) = chebyshevpoints(Float64, n; kind=kind)

test/chebyshevtests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ using FastTransforms, Compat, Compat.Test
66
@test chebyshevpoints(10; kind=2) == chebyshevpoints(Float64, 10; kind=2)
77
for T in (Float32, Float64, ComplexF32, ComplexF64)
88
@test chebyshevpoints(T, 0, kind=1) == chebyshevpoints(T, 0, kind=2) == T[]
9-
@test chebyshevpoints(T, 1, kind=1) == chebyshevpoints(T, 1, kind=2) == T[]
9+
@test chebyshevpoints(T, 1, kind=1) == chebyshevpoints(T, 1, kind=2) == T[0]
1010

1111
n = 20
1212
@inferred(chebyshevpoints(T, n, kind=1))
13-
@inferred(chebyshevpoints(T, n, kind=1))
13+
@inferred(chebyshevpoints(T, n, kind=2))
14+
@test_throws ArgumentError chebyshevpoints(n, kind=-1)
1415
end
1516
end
1617

0 commit comments

Comments
 (0)