@@ -61,6 +61,11 @@ function applydim!(op!, X::AbstractArray, Rpre, Rpost, ind)
6161 end
6262 X
6363end
64+ function applydim! (op!, X:: AbstractArray , d:: Integer , ind)
65+ Rpre = CartesianIndices (axes (X)[1 : d- 1 ])
66+ Rpost = CartesianIndices (axes (X)[d+ 1 : end ])
67+ applydim! (op!, X, Rpre, Rpost, ind)
68+ end
6469
6570for op in (:ldiv , :lmul )
6671 op_dim_begin! = Symbol (op, :_dim_begin! )
@@ -70,17 +75,13 @@ for op in (:ldiv, :lmul)
7075 function $op_dim_begin! (α, d:: Number , y:: AbstractArray )
7176 # scale just the d-th dimension by permuting it to the first
7277 d ∈ 1 : ndims (y) || throw (ArgumentError (" dimension $d must lie between 1 and $(ndims (y)) " ))
73- Rpre = CartesianIndices (axes (y)[1 : d- 1 ])
74- Rpost = CartesianIndices (axes (y)[d+ 1 : end ])
75- applydim! (v -> $ op! (α, v), y, Rpre, Rpost, 1 )
78+ applydim! (v -> $ op! (α, v), y, d, 1 )
7679 end
7780
7881 function $op_dim_end! (α, d:: Number , y:: AbstractArray )
7982 # scale just the d-th dimension by permuting it to the first
8083 d ∈ 1 : ndims (y) || throw (ArgumentError (" dimension $d must lie between 1 and $(ndims (y)) " ))
81- Rpre = CartesianIndices (axes (y)[1 : d- 1 ])
82- Rpost = CartesianIndices (axes (y)[d+ 1 : end ])
83- applydim! (v -> $ op! (α, v), y, Rpre, Rpost, size (y, d))
84+ applydim! (v -> $ op! (α, v), y, d, size (y, d))
8485 end
8586 end
8687end
@@ -383,9 +384,7 @@ for f in [:_chebu1_prescale!, :_chebu1_postscale!, :_chebu2_prescale!, :_chebu2_
383384 @eval begin
384385 @inline function $f (d:: Number , X:: AbstractArray )
385386 d ∈ 1 : ndims (X) || throw (" dimension $d must lie between 1 and $(ndims (X)) " )
386- Rpre = CartesianIndices (axes (X)[1 : d- 1 ])
387- Rpost = CartesianIndices (axes (X)[d+ 1 : end ])
388- $ _f (d, X, Rpre, Rpost)
387+ $ _f (d, X)
389388 X
390389 end
391390 @inline function $f (d, y:: AbstractArray )
@@ -397,16 +396,16 @@ for f in [:_chebu1_prescale!, :_chebu1_postscale!, :_chebu2_prescale!, :_chebu2_
397396 end
398397end
399398
400- function __chebu1_prescale! (d:: Number , X:: AbstractArray{T} , Rpre, Rpost ) where {T}
399+ function __chebu1_prescale! (d:: Number , X:: AbstractArray{T} ) where {T}
401400 m = size (X,d)
402401 r = one (T)/ (2 m) .+ ((1 : m) .- one (T)). / m
403- applydim! (v -> v .*= sinpi .(r) ./ m, X, Rpre, Rpost , :)
402+ applydim! (v -> v .*= sinpi .(r) ./ m, X, d , :)
404403end
405404
406- @inline function __chebu1_postscale! (d:: Number , X:: AbstractArray{T} , Rpre, Rpost ) where {T}
405+ @inline function __chebu1_postscale! (d:: Number , X:: AbstractArray{T} ) where {T}
407406 m = size (X,d)
408407 r = one (T)/ (2 m) .+ ((1 : m) .- one (T)). / m
409- applydim! (v -> v ./= sinpi .(r) ./ m, X, Rpre, Rpost , :)
408+ applydim! (v -> v ./= sinpi .(r) ./ m, X, d , :)
410409end
411410
412411function * (P:: ChebyshevUTransformPlan{T,1,K,true,N} , x:: AbstractArray{T,N} ) where {T,K,N}
@@ -428,18 +427,18 @@ function mul!(y::AbstractArray{T}, P::ChebyshevUTransformPlan{T,1,K,false}, x::A
428427end
429428
430429
431- @inline function __chebu2_prescale! (d, X:: AbstractArray{T} , Rpre, Rpost ) where {T}
430+ @inline function __chebu2_prescale! (d, X:: AbstractArray{T} ) where {T}
432431 m = size (X,d)
433432 c = one (T)/ (m+ 1 )
434433 r = (1 : m) .* c
435- applydim! (v -> v .*= sinpi .(r), X, Rpre, Rpost , :)
434+ applydim! (v -> v .*= sinpi .(r), X, d , :)
436435end
437436
438- @inline function __chebu2_postscale! (d:: Number , X:: AbstractArray{T} , Rpre, Rpost ) where {T}
437+ @inline function __chebu2_postscale! (d:: Number , X:: AbstractArray{T} ) where {T}
439438 m = size (X,d)
440439 c = one (T)/ (m+ 1 )
441440 r = (1 : m) .* c
442- applydim! (v -> v ./= sinpi .(r), X, Rpre, Rpost , :)
441+ applydim! (v -> v ./= sinpi .(r), X, d , :)
443442end
444443
445444function * (P:: ChebyshevUTransformPlan{T,2,K,true,N} , x:: AbstractArray{T,N} ) where {T,K,N}
@@ -523,10 +522,10 @@ inv(P::IChebyshevUTransformPlan{T,2}) where {T} = ChebyshevUTransformPlan{T,2}(P
523522inv (P:: ChebyshevUTransformPlan{T,1} ) where {T} = IChebyshevUTransformPlan {T,1} (inv (P. plan). p)
524523inv (P:: IChebyshevUTransformPlan{T,1} ) where {T} = ChebyshevUTransformPlan {T,1} (inv (P. plan). p)
525524
526- @inline function __ichebu1_postscale! (d:: Number , X:: AbstractArray{T} , Rpre, Rpost ) where {T}
525+ @inline function __ichebu1_postscale! (d:: Number , X:: AbstractArray{T} ) where {T}
527526 m = size (X,d)
528527 r = one (T)/ (2 m) .+ ((1 : m) .- one (T))/ m
529- applydim! (v -> v ./= 2 .* sinpi .(r), X, Rpre, Rpost , :)
528+ applydim! (v -> v ./= 2 .* sinpi .(r), X, d , :)
530529end
531530
532531function * (P:: IChebyshevUTransformPlan{T,1,K,true} , x:: AbstractArray{T} ) where {T<: fftwNumber ,K}
0 commit comments