@@ -137,26 +137,28 @@ function *(P::ChebyshevToLegendrePlanTH, v::AbstractVector{S}) where S
137
137
v
138
138
end
139
139
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
143
143
ret = zero (S)
144
144
@inbounds for k = 1 : 2 : m
145
- ret += - V[k,j ]/ (k* (k- 2 ))
145
+ ret += - V[Ipre,k,Ipost ]/ (k* (k- 2 ))
146
146
end
147
- V[1 ,j ] = ret
147
+ V[Ipre, 1 ,Ipost ] = ret
148
148
end
149
149
V
150
150
end
151
151
152
152
_dropfirstdim (d:: Int ) = ()
153
153
_dropfirstdim (d:: Int , m, szs... ) = ((d == 1 ? 2 : 1 ): m, _dropfirstdim (d- 1 , szs... )... )
154
154
155
- function * (P:: ChebyshevToLegendrePlanTH , V:: AbstractArray{<:Any,N} ) where N
155
+ function * (P:: ChebyshevToLegendrePlanTH , V:: AbstractArray )
156
156
m,n = size (V)
157
157
tmp = P. toeplitzhankel. tmp
158
158
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)
160
162
_th_applymul! (d, view (V, _dropfirstdim (d, size (V)... )... ), T, L, R, tmp)
161
163
end
162
164
V
@@ -729,4 +731,4 @@ th_cheb2jac(v, α, β, dims...) = plan_th_cheb2jac!(eltype(v), size(v), α, β,
729
731
730
732
plan_th_jac2cheb! (:: Type{T} , mn, α, β, dims... ) where T = Jac2ChebPlanTH (plan_th_jac2jac! (T, mn, α, β, - one (α)/ 2 , - one (α)/ 2 , dims... ))
731
733
plan_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