You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into some unexpected behavior with both FFTW.jl and FastTransforms.jl but notCUFFT.jl. I am thinking this repo is the appropriate location to raise this issue, but its possible it is an issue with both FFTW.jl and FastTransforms.jl
Summary
When applying a irfft plan to a Fourier space matrix uhat with mul! and a preallocated output array u, uhat is unexpectedly mutated.
Given a uhat matrix of elements ComplexF64 and shape (3,4), these work as expected:
u =irfft(uhat, 4, 1:2)
plan =plan_irfft(uhat, 4, 1:2)
u = plan * uhat
this generates the correct u, but mutates uhat:
plan =plan_irfft(uhat, 4, 1:2)
u =zeros(4,4)
mul!(u, plan, uhat)
Reproduction
using FFTW
using LinearAlgebra: mul!
# (3,4) array
uhat =ComplexF64.([
1234;
1234;
1234;
])
## first, perform an irfft without a plan#
u =irfft(uhat, 4, 1:2)
println("\n\n########\n########")
println("unplanned irfft:")
display(u)
println("û: unchanged:")
display(uhat)
# generate an irfft plan
plan =plan_irfft(uhat, 4, 1:2)
## calculate the irfft with the plan (allocates)#
u_plan = plan * uhat
println("\n\n########\n########")
println("planned irfft with allocation:")
display(u_plan)
println("uhat: unchanged:")
display(uhat)
## calculate the irfft with the plan (reuse allocation)#
u_plan_preallocation =zeros(4,4)
mul!(u_plan_preallocation, plan, uhat)
println("\n\n########\n########")
println("planned irfft with preallocation:")
display(u_plan)
println("uhat: HAS changed:")
display(uhat)
I ran into some unexpected behavior with both
FFTW.jl
andFastTransforms.jl
but notCUFFT.jl
. I am thinking this repo is the appropriate location to raise this issue, but its possible it is an issue with bothFFTW.jl
andFastTransforms.jl
Summary
When applying a irfft plan to a Fourier space matrix
uhat
withmul!
and a preallocated output arrayu
,uhat
is unexpectedly mutated.Given a
uhat
matrix of elementsComplexF64
and shape(3,4)
, these work as expected:this generates the correct
u
, but mutatesuhat
:Reproduction
This outputs:
The text was updated successfully, but these errors were encountered: