@@ -234,6 +234,8 @@ plan_rfft(x::AbstractArray, region; kws...) = plan_rfft(realfloat(x), region; kw
234
234
_pinv_type (p:: Plan ) = typeof ([plan_inv (x) for x in typeof (p)[]])
235
235
pinv_type (p:: Plan ) = eltype (_pinv_type (p))
236
236
237
+ function plan_inv end
238
+
237
239
inv (p:: Plan ) =
238
240
isdefined (p, :pinv ) ? p. pinv:: pinv_type (p) : (p. pinv = plan_inv (p))
239
241
\ (p:: Plan , x:: AbstractArray ) = inv (p) * x
@@ -243,10 +245,9 @@ LinearAlgebra.ldiv!(y::AbstractArray, p::Plan, x::AbstractArray) = LinearAlgebra
243
245
# implementations only need to provide the unnormalized backwards FFT,
244
246
# similar to FFTW, and we do the scaling generically to get the ifft:
245
247
246
- mutable struct ScaledPlan{T,P,N} <: Plan{T}
248
+ struct ScaledPlan{T,P,N} <: Plan{T}
247
249
p:: P
248
250
scale:: N # not T, to avoid unnecessary promotion to Complex
249
- pinv:: Plan
250
251
ScaledPlan {T,P,N} (p, scale) where {T,P,N} = new (p, scale)
251
252
end
252
253
ScaledPlan {T} (p:: P , scale:: N ) where {T,P,N} = ScaledPlan {T,P,N} (p, scale)
@@ -278,7 +279,7 @@ plan_ifft(x::AbstractArray, region; kws...) =
278
279
plan_ifft! (x:: AbstractArray , region; kws... ) =
279
280
ScaledPlan (plan_bfft! (x, region; kws... ), normalization (x, region))
280
281
281
- plan_inv (p:: ScaledPlan ) = ScaledPlan (inv (p. p), inv (p. scale))
282
+ inv (p:: ScaledPlan ) = ScaledPlan (inv (p. p), inv (p. scale))
282
283
283
284
LinearAlgebra. mul! (y:: AbstractArray , p:: ScaledPlan , x:: AbstractArray ) =
284
285
LinearAlgebra. lmul! (p. scale, LinearAlgebra. mul! (y, p. p, x))
0 commit comments