# Fourier transform of a Dual vector

**URL:** <https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538>\
**Category:** Signal and Image Processing\
**Tags:** question, fft\
**Created:** [August 23, 2024, 5:23pm UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538 "2024-08-23T17:23:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdqb](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@cdqb](https://discourse.julialang.org/u/cdqb)\
**Post date:** [August 23, 2024, 5:23pm UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538/1 "2024-08-23T17:23:38Z")

</div>

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:

```julia
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.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 23, 2024, 5:26pm UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538/2 "2024-08-23T17:26:52Z")

</div>

I would start looking into AbstractFFTs.jl to find implementations.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [August 23, 2024, 5:59pm UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538/3 "2024-08-23T17:59:24Z")

</div>

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](https://github.com/JuliaDiff/ForwardDiff.jl/pull/668) isn’t marged yet. Maybe [this package](https://github.com/JuliaApproximation/FastTransformsForwardDiff.jl) works?

---

<div class="post-metadata">

**Author:** ![cdqb](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@cdqb](https://discourse.julialang.org/u/cdqb)\
**Post date:** [August 23, 2024, 7:15pm UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538/4 "2024-08-23T19:15:43Z")

</div>

Thank you both for the pointers! [The PR](https://github.com/JuliaDiff/ForwardDiff.jl/pull/668) 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.

---

<div class="post-metadata">

**Author:** ![brainandforce](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brainandforce/32/211054_2.png) [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Post date:** [November 18, 2025, 7:46am UTC](https://discourse.julialang.org/t/fourier-transform-of-a-dual-vector/118538/5 "2025-11-18T07:46:47Z")

</div>

> [@cdqb](#):
>
> [FastTransformsForwardDiff.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/FastTransformsForwardDiff) at least does not work as it is (by overloading the correct methods), but I’ll see if I can get something to run.

Any chance you have something working? I’m interested in implementing generalized Fourier transforms to Clifford algebras, and the dual numbers are a Clifford algebra (in fact, if this is of interest to you, they can generalize to arbitrary numbers of dimensions).
