FFT with @view

Fundamentally, you need a complex destination for your FFT, and then the docs for the AbstractFFT interface make it clear that the mul! interface requires both input and output to be complex arrays:

julia> using FFTW, LinearAlgebra

julia> M = randn(100, 100, 100);

julia> Mc = complex(M);

julia> C = @view Mc[:, :, 1];

julia> A = @view Mc[:, :, 2];

julia> B = plan_fft(C);

julia> mul!(A, B, C)
100×100 view(::Array{ComplexF64, 3}, :, :, 2) with eltype ComplexF64:
...
3 Likes