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
Currently fft fails for Unitful data. It is pretty easy to write a work-around that does not even add any dependency on the Unitful package, by using oneunit in Base:
using Unitful: mm
using FFTW: fft
import FFTW: fft
x =ones(8)*mm
#fft(x) # fails ERROR: LoadError: MethodError: no method matching plan_fft...functionfft(x::AbstractArray{<:Number})
u =oneunit(eltype(x))
returnfft(x / u) * u
endfft(x) # works as desired
Edit: perhaps the support should be added at the plan_fft level or such.
Would there be openness for a PR to add such support to FFTW?
The text was updated successfully, but these errors were encountered:
It should be fairly easy to do this by reinterpreting arrays, at least for simple dense arrays of constant units. Something like PainterQubits/Unitful.jl#437 except easier since fft only acts one one array. Unitful would probably need to depend on AbstractFFTs.
Currently
fft
fails for Unitful data. It is pretty easy to write a work-around that does not even add any dependency on the Unitful package, by usingoneunit
in Base:Edit: perhaps the support should be added at the
plan_fft
level or such.Would there be openness for a PR to add such support to FFTW?
The text was updated successfully, but these errors were encountered: