I am trying to Fourier transform a vector of Dual numbers (or rather, ForwardDiff is trying to do that for me as part of a bigger task). However, this does not seem to work with the perhaps most commonly used package FFTW.

A simple example:

using FFTW, DualNumbers
a = [Dual(1,2), Dual(3,4), Dual(5,6)]
fft(a)

This gives the error: ERROR: MethodError: no method matching plan_fft(::Vector{Dual{Int64}}, ::UnitRange{Int64})

Is there any way around this or are there packages that implement FFTs on Duals? I have been unsuccessful in my search but have a feeling that this should be a solved issue given fields such as machine learning.

FFTW only understands certain data types. But since fft is linear, the answer you want is always Dual numbers made up of fft of components of the original dual numbers. In principle that is easy to arrange, but… this PR isn’t marged yet. Maybe this package works?

Thank you both for the pointers! The PR linked by mcabbott seems to be exactly what would be needed, it’s unfortunate that it seems to have gotten stuck.

FastTransformsForwardDiff.jl at least does not work as it is (by overloading the correct methods), but I’ll see if I can get something to run.