|
49 | 49 |
|
50 | 50 |
|
51 | 51 | # convert x if necessary |
52 | | -@inline _plan_mul!(y::AbstractArray{T}, P::Plan{T}, x::StridedArray{T}) where T = mul!(y, P, x) |
53 | | -@inline _plan_mul!(y::AbstractArray{T}, P::Plan{T}, x::AbstractArray) where T = mul!(y, P, convert(Array{T}, x)) |
| 52 | +_maybemutablecopy(x::StridedArray{T}, ::Type{T}) where {T} = x |
| 53 | +_maybemutablecopy(x, T) = Array{T}(x) |
| 54 | +@inline _plan_mul!(y::AbstractArray{T}, P::Plan{T}, x::AbstractArray) where T = mul!(y, P, _maybemutablecopy(x, T)) |
54 | 55 |
|
55 | 56 |
|
56 | 57 | for op in (:ldiv, :lmul) |
@@ -309,7 +310,8 @@ function mul!(y::AbstractArray{T,N}, P::IChebyshevTransformPlan{T,2,K,false,N}, |
309 | 310 | _icheb2_rescale!(P.plan.region, y) |
310 | 311 | end |
311 | 312 |
|
312 | | -*(P::IChebyshevTransformPlan{T,kind,K,false,N}, x::AbstractArray{T,N}) where {T,kind,K,N} = mul!(similar(x), P, x) |
| 313 | +*(P::IChebyshevTransformPlan{T,kind,K,false,N}, x::AbstractArray{T,N}) where {T,kind,K,N} = |
| 314 | + mul!(similar(x), P, _maybemutablecopy(x, T)) |
313 | 315 | ichebyshevtransform!(x::AbstractArray, dims...; kwds...) = plan_ichebyshevtransform!(x, dims...; kwds...)*x |
314 | 316 | ichebyshevtransform(x, dims...; kwds...) = plan_ichebyshevtransform(x, dims...; kwds...)*x |
315 | 317 |
|
|
0 commit comments