In the following code, I have commented out all the lines that produce a MethodError
:
using FFTW, SparseArrays
fft(rand(Float64, 50, 50))
fft(rand(ComplexF64, 50, 50))
fft(rand(Float32, 50, 50))
fft(rand(ComplexF32, 50, 50))
fft(rand(Float16, 50, 50))
# fft(rand(ComplexF16, 50, 50))
fft(sprand(Float64, 50, 50, 0.2))
# fft(sprand(ComplexF64, 50, 50, 0.2))
fft(sprand(Float32, 50, 50, 0.2))
# fft(sprand(ComplexF32, 50, 50, 0.2))
fft(sprand(Float16, 50, 50, 0.2))
# fft(sprand(ComplexF16, 50, 50, 0.2))
ifft(rand(Float64, 50, 50))
ifft(rand(ComplexF64, 50, 50))
ifft(rand(Float32, 50, 50))
ifft(rand(ComplexF32, 50, 50))
ifft(rand(Float16, 50, 50))
# ifft(rand(ComplexF16, 50, 50))
ifft(sprand(Float64, 50, 50, 0.2))
# ifft(sprand(ComplexF64, 50, 50, 0.2))
ifft(sprand(Float32, 50, 50, 0.2))
# ifft(sprand(ComplexF32, 50, 50, 0.2))
ifft(sprand(Float16, 50, 50, 0.2))
# ifft(sprand(ComplexF16, 50, 50, 0.2))
It seems odd to me that fft()
and ifft()
would be defined for Float16
but not ComplexF16
, and also that there is no support for sparse arrays of any kind of complex float. Is this an issue with FFTW.jl or the underlying FFTW library itself?
The lack of support for sparse complex arrays makes it difficult to do (for example) FFT image compression in a meaningful way, because the output of res = fft(sprand(Float32, 50, 50, 0.5))
is a Matrix{ComplexF32}
. Discarding low coefficients only saves memory if we then convert res
to a sprase format that can be ifft
ed directly.