JuliaMath / JuliaMath/FFTW.jl

Support Unitful data?

Open
#225 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
300
Forks
61
PR merge metrics
No merged PRs in 30d

Description

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:

```julia
using Unitful: mm
using FFTW: fft
import FFTW: fft

x = ones(8)*mm
#fft(x) # fails ERROR: LoadError: MethodError: no method matching plan_fft...

function fft(x::AbstractArray{<:Number})
u = oneunit(eltype(x))
return fft(x / u) * u
end

fft(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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.