Skip to content

Commit

Permalink
Fix another type instability
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav-arya committed Aug 22, 2023
1 parent 18631da commit ee4b225
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,11 @@ function adjoint_mul(p::Plan{T}, x::AbstractArray, ::FFTAdjointStyle) where {T}
pinv = inv(p)
# Optimization: when pinv is a ScaledPlan, check if we can avoid a loop over x.
# Even if not, ensure that we do only one pass by combining the normalization with the plan.
scaled_pinv = if pinv isa ScaledPlan && isapprox(pinv.scale, N)
pinv.p
if pinv isa ScaledPlan && isapprox(pinv.scale, N)
return pinv.p * x
else
(1/N) * pinv
return (1/N * pinv) * x

Check warning on line 689 in src/definitions.jl

View check run for this annotation

Codecov / codecov/patch

src/definitions.jl#L689

Added line #L689 was not covered by tests
end
return scaled_pinv * x
end

function adjoint_mul(p::Plan{T}, x::AbstractArray, ::RFFTAdjointStyle) where {T<:Real}
Expand Down

0 comments on commit ee4b225

Please sign in to comment.