diff --git a/src/toeplitzhankel.jl b/src/toeplitzhankel.jl index 740958dc..fef934f6 100644 --- a/src/toeplitzhankel.jl +++ b/src/toeplitzhankel.jl @@ -189,7 +189,7 @@ for f in (:leg2cheb, :leg2chebu) TLC = Symbol("_", f, "TH_TLC") @eval begin $plan(::Type{S}, mn::NTuple{N,Int}, dims::Int) where {S,N} = ToeplitzHankelPlan($TLC(S, mn, dims)..., dims) - function $plan(::Type{S}, mn::NTuple{N,Int}, dims=ntuple(identity,Val(N))) where {S,N} + function $plan(::Type{S}, mn::NTuple{N,Int}, dims) where {S,N} TLCs = $TLC.(S, Ref(mn), dims) ToeplitzHankelPlan{S,N}(map(first, TLCs), map(TLC -> TLC[2], TLCs), map(last, TLCs), dims) end @@ -221,7 +221,7 @@ end plan_th_cheb2leg!(::Type{S}, mn::NTuple{N,Int}, dims::Int) where {S,N} = ChebyshevToLegendrePlanTH(ToeplitzHankelPlan(_cheb2legTH_TLC(S, mn, dims)..., dims)) -function plan_th_cheb2leg!(::Type{S}, mn::NTuple{N,Int}, dims=ntuple(identity,Val(N))) where {S,N} +function plan_th_cheb2leg!(::Type{S}, mn::NTuple{N,Int}, dims) where {S,N} TLCs = _cheb2legTH_TLC.(S, Ref(mn), dims) ChebyshevToLegendrePlanTH(ToeplitzHankelPlan{S,N}(map(first, TLCs), map(TLC -> TLC[2], TLCs), map(last, TLCs), dims)) end diff --git a/test/toeplitzhankeltests.jl b/test/toeplitzhankeltests.jl index 245f19b4..b90ce94b 100644 --- a/test/toeplitzhankeltests.jl +++ b/test/toeplitzhankeltests.jl @@ -132,36 +132,35 @@ Random.seed!(0) end @testset "tensor" begin - X = randn(5,4,3) - for trans in (th_leg2cheb, th_cheb2leg) - Y = trans(X, 1) - for ℓ = 1:size(X,3) - @test Y[:,:,ℓ] ≈ trans(X[:,:,ℓ],1) - end - Y = trans(X, 2) - for ℓ = 1:size(X,3) - @test Y[:,:,ℓ] ≈ trans(X[:,:,ℓ],2) - end - Y = trans(X, 3) - for j = 1:size(X,2) - @test Y[:,j,:] ≈ trans(X[:,j,:],2) - end - - Y = trans(X, (1,3)) - for j = 1:size(X,2) - @test Y[:,j,:] ≈ trans(X[:,j,:]) - end - - Y = trans(X, 1:3) - M = copy(X) - for j = 1:size(X,3) - M[:,:,j] = trans(M[:,:,j]) - end - for k = 1:size(X,1), j=1:size(X,2) - M[k,j,:] = trans(M[k,j,:]) - end - @test M ≈ Y + X = randn(5,4,3) + for trans in (th_leg2cheb, th_cheb2leg) + Y = trans(X, 1) + for ℓ = 1:size(X,3) + @test Y[:,:,ℓ] ≈ trans(X[:,:,ℓ],1) end + Y = trans(X, 2) + for ℓ = 1:size(X,3) + @test Y[:,:,ℓ] ≈ trans(X[:,:,ℓ],2) + end + Y = trans(X, 3) + for j = 1:size(X,2) + @test Y[:,j,:] ≈ trans(X[:,j,:],2) + end + + Y = trans(X, (1,3)) + for j = 1:size(X,2) + @test Y[:,j,:] ≈ trans(X[:,j,:]) + end + + Y = trans(X, 1:3) + M = copy(X) + for j = 1:size(X,3) + M[:,:,j] = trans(M[:,:,j]) + end + for k = 1:size(X,1), j=1:size(X,2) + M[k,j,:] = trans(M[k,j,:]) + end + @test M ≈ Y end end end \ No newline at end of file