@@ -137,26 +137,28 @@ function *(P::ChebyshevToLegendrePlanTH, v::AbstractVector{S}) where S
137137 v
138138end
139139
140- function _cheb2leg_rescale1! (V:: AbstractArray{S} ) where S
141- m = size (V,1 )
142- for j = CartesianIndices ( tail ( axes (V)))
140+ function _cheb2leg_rescale1! (V:: AbstractArray{S} , Rpre, Rpost, d ) where S
141+ m = size (V,d )
142+ for Ipost in Rpost, Ipre in Rpre
143143 ret = zero (S)
144144 @inbounds for k = 1 : 2 : m
145- ret += - V[k,j ]/ (k* (k- 2 ))
145+ ret += - V[Ipre,k,Ipost ]/ (k* (k- 2 ))
146146 end
147- V[1 ,j ] = ret
147+ V[Ipre, 1 ,Ipost ] = ret
148148 end
149149 V
150150end
151151
152152_dropfirstdim (d:: Int ) = ()
153153_dropfirstdim (d:: Int , m, szs... ) = ((d == 1 ? 2 : 1 ): m, _dropfirstdim (d- 1 , szs... )... )
154154
155- function * (P:: ChebyshevToLegendrePlanTH , V:: AbstractArray{<:Any,N} ) where N
155+ function * (P:: ChebyshevToLegendrePlanTH , V:: AbstractArray )
156156 m,n = size (V)
157157 tmp = P. toeplitzhankel. tmp
158158 for (d,R,L,T) in zip (P. toeplitzhankel. dims,P. toeplitzhankel. R,P. toeplitzhankel. L,P. toeplitzhankel. T)
159- _cheb2leg_rescale1! (PermutedDimsArray (V, _permfirst (d, N)))
159+ Rpre = CartesianIndices (axes (V)[1 : d- 1 ])
160+ Rpost = CartesianIndices (axes (V)[d+ 1 : end ])
161+ _cheb2leg_rescale1! (V, Rpre, Rpost, d)
160162 _th_applymul! (d, view (V, _dropfirstdim (d, size (V)... )... ), T, L, R, tmp)
161163 end
162164 V
@@ -729,4 +731,4 @@ th_cheb2jac(v, α, β, dims...) = plan_th_cheb2jac!(eltype(v), size(v), α, β,
729731
730732plan_th_jac2cheb! (:: Type{T} , mn, α, β, dims... ) where T = Jac2ChebPlanTH (plan_th_jac2jac! (T, mn, α, β, - one (α)/ 2 , - one (α)/ 2 , dims... ))
731733plan_th_jac2cheb! (arr:: AbstractArray{T} , α, β, dims... ) where T = plan_th_jac2cheb! (T, size (arr), α, β, dims... )
732- th_jac2cheb (v, α, β, dims... ) = plan_th_jac2cheb! (eltype (v), size (v), α, β, dims... )* copy (v)
734+ th_jac2cheb (v, α, β, dims... ) = plan_th_jac2cheb! (eltype (v), size (v), α, β, dims... )* copy (v)
0 commit comments