@@ -61,6 +61,11 @@ function applydim!(op!, X::AbstractArray, Rpre, Rpost, ind)
61
61
end
62
62
X
63
63
end
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
64
69
65
70
for op in (:ldiv , :lmul )
66
71
op_dim_begin! = Symbol (op, :_dim_begin! )
@@ -70,17 +75,13 @@ for op in (:ldiv, :lmul)
70
75
function $op_dim_begin! (α, d:: Number , y:: AbstractArray )
71
76
# scale just the d-th dimension by permuting it to the first
72
77
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 )
76
79
end
77
80
78
81
function $op_dim_end! (α, d:: Number , y:: AbstractArray )
79
82
# scale just the d-th dimension by permuting it to the first
80
83
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))
84
85
end
85
86
end
86
87
end
@@ -383,9 +384,7 @@ for f in [:_chebu1_prescale!, :_chebu1_postscale!, :_chebu2_prescale!, :_chebu2_
383
384
@eval begin
384
385
@inline function $f (d:: Number , X:: AbstractArray )
385
386
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)
389
388
X
390
389
end
391
390
@inline function $f (d, y:: AbstractArray )
@@ -397,16 +396,16 @@ for f in [:_chebu1_prescale!, :_chebu1_postscale!, :_chebu2_prescale!, :_chebu2_
397
396
end
398
397
end
399
398
400
- function __chebu1_prescale! (d:: Number , X:: AbstractArray{T} , Rpre, Rpost ) where {T}
399
+ function __chebu1_prescale! (d:: Number , X:: AbstractArray{T} ) where {T}
401
400
m = size (X,d)
402
401
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 , :)
404
403
end
405
404
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}
407
406
m = size (X,d)
408
407
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 , :)
410
409
end
411
410
412
411
function * (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
428
427
end
429
428
430
429
431
- @inline function __chebu2_prescale! (d, X:: AbstractArray{T} , Rpre, Rpost ) where {T}
430
+ @inline function __chebu2_prescale! (d, X:: AbstractArray{T} ) where {T}
432
431
m = size (X,d)
433
432
c = one (T)/ (m+ 1 )
434
433
r = (1 : m) .* c
435
- applydim! (v -> v .*= sinpi .(r), X, Rpre, Rpost , :)
434
+ applydim! (v -> v .*= sinpi .(r), X, d , :)
436
435
end
437
436
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}
439
438
m = size (X,d)
440
439
c = one (T)/ (m+ 1 )
441
440
r = (1 : m) .* c
442
- applydim! (v -> v ./= sinpi .(r), X, Rpre, Rpost , :)
441
+ applydim! (v -> v ./= sinpi .(r), X, d , :)
443
442
end
444
443
445
444
function * (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
523
522
inv (P:: ChebyshevUTransformPlan{T,1} ) where {T} = IChebyshevUTransformPlan {T,1} (inv (P. plan). p)
524
523
inv (P:: IChebyshevUTransformPlan{T,1} ) where {T} = ChebyshevUTransformPlan {T,1} (inv (P. plan). p)
525
524
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}
527
526
m = size (X,d)
528
527
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 , :)
530
529
end
531
530
532
531
function * (P:: IChebyshevUTransformPlan{T,1,K,true} , x:: AbstractArray{T} ) where {T<: fftwNumber ,K}
0 commit comments