Skip to content

Commit 90d1dae

Browse files
authored
Cheb2LegTH <: Plan (#234)
* Cheb2LegTH <: Plan * avoid stack overflow in different sizes
1 parent dcaf8f6 commit 90d1dae

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/chebyshevtransform.jl

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
abstract type ChebyshevPlan{T} <: Plan{T} end
44

5+
*(P::ChebyshevPlan{T}, x::AbstractArray{T}) where T = error("Plan applied to wrong size array")
6+
57
size(P::ChebyshevPlan) = isdefined(P, :plan) ? size(P.plan) : (0,)
68
length(P::ChebyshevPlan) = isdefined(P, :plan) ? length(P.plan) : 0
79

@@ -151,6 +153,8 @@ end
151153
ldiv!(_prod_size(size(y), d), y)
152154
end
153155

156+
157+
154158
function *(P::ChebyshevTransformPlan{T,1,K,true,N}, x::AbstractArray{T,N}) where {T,K,N}
155159
isempty(x) && return x
156160

src/toeplitzhankel.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118

119119

120120

121-
struct ChebyshevToLegendrePlanTH{TH}
121+
struct ChebyshevToLegendrePlanTH{S,TH<:ToeplitzHankelPlan{S}} <: Plan{S}
122122
toeplitzhankel::TH
123123
end
124124

test/chebyshevtests.jl

+5
Original file line numberDiff line numberDiff line change
@@ -462,4 +462,9 @@ using FastTransforms, Test
462462
@test F \ (F*X) F * (F\X) X
463463
end
464464
end
465+
466+
@testset "incompatible shapes" begin
467+
@test_throws ErrorException plan_chebyshevtransform(randn(5)) * randn(5,5)
468+
@test_throws ErrorException plan_ichebyshevtransform(randn(5)) * randn(5,5)
469+
end
465470
end

0 commit comments

Comments
 (0)