diff --git a/Project.toml b/Project.toml index de834436..9feabc65 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FastTransforms" uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c" -version = "0.15.4" +version = "0.15.5" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" @@ -18,7 +18,7 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24" [compat] AbstractFFTs = "1.0" -FFTW = "~1.6" +FFTW = "1.7" FastGaussQuadrature = "0.4, 0.5" FastTransforms_jll = "0.6.2" FillArrays = "0.9, 0.10, 0.11, 0.12, 0.13, 1" diff --git a/src/chebyshevtransform.jl b/src/chebyshevtransform.jl index c77941d8..11e07010 100644 --- a/src/chebyshevtransform.jl +++ b/src/chebyshevtransform.jl @@ -19,11 +19,9 @@ ChebyshevTransformPlan{T,kind}(plan::FFTW.r2rFFTWPlan{T,K,inplace,N,R}) where {T ChebyshevTransformPlan{T,kind,K,inplace,N,R}(plan) # jump through some hoops to make inferrable -@inline kindtuple(N) = NTuple{N,Int32} -@inline kindtuple(N,region...) = Vector{Int32} function plan_chebyshevtransform!(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - ChebyshevTransformPlan{T,1,kindtuple(N,dims...),true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + ChebyshevTransformPlan{T,1,Vector{Int32},true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else ChebyshevTransformPlan{T,1}(FFTW.plan_r2r!(x, FIRSTKIND, dims...; kws...)) end @@ -36,7 +34,7 @@ end function plan_chebyshevtransform(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - ChebyshevTransformPlan{T,1,kindtuple(N,dims...),false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + ChebyshevTransformPlan{T,1,Vector{Int32},false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else ChebyshevTransformPlan{T,1}(FFTW.plan_r2r(x, FIRSTKIND, dims...; kws...)) end @@ -250,7 +248,7 @@ inv(P::IChebyshevTransformPlan{T,1}) where {T} = ChebyshevTransformPlan{T,1}(inv function plan_ichebyshevtransform!(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - IChebyshevTransformPlan{T,1,kindtuple(N,dims...),true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + IChebyshevTransformPlan{T,1,Vector{Int32},true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else IChebyshevTransformPlan{T,1}(FFTW.plan_r2r!(x, IFIRSTKIND, dims...; kws...)) end @@ -262,7 +260,7 @@ end function plan_ichebyshevtransform(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - IChebyshevTransformPlan{T,1,kindtuple(N,dims...),false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + IChebyshevTransformPlan{T,1,Vector{Int32},false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else IChebyshevTransformPlan{T,1}(FFTW.plan_r2r(x, IFIRSTKIND, dims...; kws...)) end @@ -390,7 +388,7 @@ ChebyshevUTransformPlan{T,kind}(plan::FFTW.r2rFFTWPlan{T,K,inplace,N,R}) where { function plan_chebyshevutransform!(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - ChebyshevUTransformPlan{T,1,kindtuple(N,dims...),true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + ChebyshevUTransformPlan{T,1,Vector{Int32},true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else ChebyshevUTransformPlan{T,1}(FFTW.plan_r2r!(x, UFIRSTKIND, dims...; kws...)) end @@ -402,7 +400,7 @@ end function plan_chebyshevutransform(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - ChebyshevUTransformPlan{T,1,kindtuple(N,dims...),false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + ChebyshevUTransformPlan{T,1,Vector{Int32},false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else ChebyshevUTransformPlan{T,1}(FFTW.plan_r2r(x, UFIRSTKIND, dims...; kws...)) end @@ -511,7 +509,7 @@ IChebyshevUTransformPlan{T,kind}(F::FFTW.r2rFFTWPlan{T,K,inplace,N,R}) where {T, function plan_ichebyshevutransform!(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - IChebyshevUTransformPlan{T,1,kindtuple(N,dims...),true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + IChebyshevUTransformPlan{T,1,Vector{Int32},true,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else IChebyshevUTransformPlan{T,1}(FFTW.plan_r2r!(x, IUFIRSTKIND, dims...; kws...)) end @@ -523,7 +521,7 @@ end function plan_ichebyshevutransform(x::AbstractArray{T,N}, ::Val{1}, dims...; kws...) where {T<:fftwNumber,N} if isempty(x) - IChebyshevUTransformPlan{T,1,kindtuple(N,dims...),false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() + IChebyshevUTransformPlan{T,1,Vector{Int32},false,N,isempty(dims) ? NTuple{N,Int} : typeof(dims[1])}() else IChebyshevUTransformPlan{T,1}(FFTW.plan_r2r(x, IUFIRSTKIND, dims...; kws...)) end diff --git a/test/chebyshevtests.jl b/test/chebyshevtests.jl index ae438ac0..696c13f0 100644 --- a/test/chebyshevtests.jl +++ b/test/chebyshevtests.jl @@ -69,10 +69,17 @@ using FastTransforms, Test @test g ≈ fcopy @test_throws ArgumentError Pi * T[1,2] - @test chebyshevtransform(T[1]) == T[1] - @test ichebyshevtransform(T[1]) == T[1] - @test chebyshevtransform(T[]) == T[] - @test ichebyshevtransform(T[]) == T[] + v = T[1] + @test chebyshevtransform(v) == v + @test ichebyshevtransform(v) == v + @test chebyshevtransform!(v) === v + @test ichebyshevtransform!(v) === v + + v = T[] + @test chebyshevtransform(v) == v + @test ichebyshevtransform(v) == v + @test chebyshevtransform!(v) === v + @test ichebyshevtransform!(v) === v end end @testset "Chebyshev second kind points <-> first kind coefficients" begin @@ -192,10 +199,17 @@ using FastTransforms, Test @test g ≈ fcopy @test_throws ArgumentError Pi * T[1,2] - @test chebyshevutransform(T[1]) == T[1] - @test ichebyshevutransform(T[1]) == T[1] - @test chebyshevutransform(T[]) == T[] - @test ichebyshevutransform(T[]) == T[] + v = T[1] + @test chebyshevutransform(v) == v + @test ichebyshevutransform(v) == v + @test chebyshevutransform!(v) === v + @test ichebyshevutransform!(v) === v + + v = T[] + @test chebyshevutransform(v) == v + @test ichebyshevutransform(v) == v + @test chebyshevutransform!(v) === v + @test ichebyshevutransform!(v) === v end end @testset "Chebyshev second kind points <-> second kind coefficients" begin