Skip to content

Commit 416d60a

Browse files
committed
Add ChebyshevToLegendrePlan
1 parent 464753f commit 416d60a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/toeplitzhankel.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,25 @@ th_leg2chebuplan{S}(::Type{S},n)=ToeplitzHankelPlan(leg2chebuTH(S,n)...,1:n,ones
132132
th_ultra2ultraplan{S}(::Type{S},n,λ₁,λ₂)=ToeplitzHankelPlan(ultra2ultraTH(S,n,λ₁,λ₂)...)
133133
th_jac2jacplan{S}(::Type{S},n,α,β,γ,δ)=ToeplitzHankelPlan(jac2jacTH(S,n,α,β,γ,δ)...)
134134

135-
th_leg2cheb(v)=th_leg2chebplan(eltype(v),length(v))*v
136-
function th_cheb2leg(v)
135+
136+
immutable ChebyshevToLegendrePlan{TH}
137+
toeplitzhankel::TH
138+
end
139+
140+
ChebyshevToLegendrePlan{S}(::Type{S},n) = ChebyshevToLegendrePlan(th_cheb2legplan(S,n))
141+
142+
143+
function *(P::ChebyshevToLegendrePlan,v::AbstractVector)
137144
w = zero(v)
138145
S,n = eltype(v),length(v)
139146
w[1:2:end] = -one(S)./(one(S):two(S):n)./(-one(S):two(S):n-two(S))
140-
[dot(w,v);th_cheb2legplan(S,n)*view(v,2:n)]
147+
[dot(w,v);P.toeplitzhankel*view(v,2:n)]
141148
end
149+
150+
151+
th_leg2cheb(v)=th_leg2chebplan(eltype(v),length(v))*v
152+
th_cheb2leg(v) = ChebyshevToLegendrePlan(eltype(v),length(v))*v
153+
142154
th_leg2chebu(v)=th_leg2chebuplan(eltype(v),length(v))*v
143155
th_ultra2ultra(v,λ₁,λ₂)=th_ultra2ultraplan(eltype(v),length(v),λ₁,λ₂)*v
144156
th_jac2jac(v,α,β,γ,δ)=th_jac2jacplan(eltype(v),length(v),α,β,γ,δ)*v

0 commit comments

Comments
 (0)