# Comparison of different fft-implementations

**URL:** <https://discourse.julialang.org/t/comparison-of-different-fft-implementations/86021>\
**Category:** Signal and Image Processing\
**Tags:** fftw, signal-processing, fft\
**Created:** [August 19, 2022, 4:29pm UTC](https://discourse.julialang.org/t/comparison-of-different-fft-implementations/86021 "2022-08-19T16:29:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 19, 2022, 5:12pm UTC](https://discourse.julialang.org/t/comparison-of-different-fft-implementations/86021/2 "2022-08-19T17:12:36Z")

</div>

> [@ellocco](#):
>
> One example is a data vector with exact `47499754` elements,  
> on my machine `FFTW.fft()` can not prosses this amount of data  
> points correctly, the amplitude is zero,

Works for me:

```julia
julia> x = rand(ComplexF64, 47499754);

julia> fft(x)
47499754-element Vector{ComplexF64}:
 2.3752510813742287e7 + 2.3752082562739518e7im
   -1857.327613402386 + 2656.595755623108im
   1.2335114129446083 - 1764.624248895477im
  -1396.5209606987896 + 1594.6473092040806im
   -994.9367333881451 - 693.3802670885018im
  -2928.6763801313805 - 1549.0585642899605im
    4545.894246165899 - 1879.5461946803975im
   1263.5570298623447 + 82.52881908200902im
  -1794.6733211109129 + 3696.6978993992598im
   -2795.508384720929 + 2427.6278018923563im
                      ⋮

```

If you use `plan_fft` with `FFTW.MEASURE` or `FFTW.PATIENT`, realize that it overwrites the data with zeros — [this is a FAQ](http://fftw.org/faq/section3.html#allzero):

> You should initialize your input array _after_ creating the plan, unless you use `FFTW_ESTIMATE` : planning with `FFTW_MEASURE` or `FFTW_PATIENT` overwrites the input/output arrays, as described in the manual.

(Realize also that 47499754 is 2 \times 23749877 where 23749877 is prime. FFTW and recent versions of SciPy support large prime factors with O(n \log n) algorithms, but sizes with small prime factors will usually be at least 10\times more efficient.)

---

_[View the full topic](https://discourse.julialang.org/t/comparison-of-different-fft-implementations/86021)._
