# \#fftw

**URL:** https://discourse.julialang.org/tag/fftw/19.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [How to manage and reuse FFTW.jl plans for multiple input sizes in Julia?](https://discourse.julialang.org/t/how-to-manage-and-reuse-fftw-jl-plans-for-multiple-input-sizes-in-julia/132877)

<div class="topic-metadata">

**Author:** [@DN\_Silence](https://discourse.julialang.org/u/DN_Silence)\
**Replies:** 5\
**Last updated:** [October 5, 2025, 4:31pm UTC](https://discourse.julialang.org/t/how-to-manage-and-reuse-fftw-jl-plans-for-multiple-input-sizes-in-julia/132877 "2025-10-05T16:31:15Z")

</div>

I am working on a Julia project where I need to perform FFTs on inputs of different sizes(and eltype, fft/ifft, in/out place). FFTW.jl allows creating plans with plan\_fft or plan\_fft!, which can significantly speed up re…

---

## [Autodifferentiation with FFT, with Enzyme?](https://discourse.julialang.org/t/autodifferentiation-with-fft-with-enzyme/128674)

<div class="topic-metadata">

**Author:** [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Replies:** 13\
**Last updated:** [September 9, 2025, 3:25pm UTC](https://discourse.julialang.org/t/autodifferentiation-with-fft-with-enzyme/128674 "2025-09-09T15:25:34Z")

</div>

Hi, I’m trying to use autodifferentiation (for gradients, jacobians), working with a complex code that uses a lot of array mutation, custom structs, and FFTs (using FFTW). I got a small part of my code working by making…

---

## [Repeated allocations for fft in pseudospectral code](https://discourse.julialang.org/t/repeated-allocations-for-fft-in-pseudospectral-code/130472)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [July 4, 2025, 4:37pm UTC](https://discourse.julialang.org/t/repeated-allocations-for-fft-in-pseudospectral-code/130472 "2025-07-04T16:37:44Z")

</div>

I’m trying to tune a pseudospectral PDE code which has calls to fft and ifft at every iteration. I was wondering if there was some way to reduce the repeated memory allocations (assuming this improves performance). By …

---

## [Mul! modifying input arrays when using FFTW.jl to compute 2D inverse RFFT](https://discourse.julialang.org/t/mul-modifying-input-arrays-when-using-fftw-jl-to-compute-2d-inverse-rfft/127970)

<div class="topic-metadata">

**Author:** [@jibe](https://discourse.julialang.org/u/jibe)\
**Replies:** 2\
**Last updated:** [April 11, 2025, 12:58pm UTC](https://discourse.julialang.org/t/mul-modifying-input-arrays-when-using-fftw-jl-to-compute-2d-inverse-rfft/127970 "2025-04-11T12:58:16Z")

</div>

I have just encountered what I believe is a bug when using FFTW.jl to compute inverse 2D FFT. As reproduced in the MWE below, the use of mul!(A,P,B) modifies the input array B. using FFTW, LinearAlgebra; N = 1; B = rand…

---

## [Extracting wave numbers using FFT and 2D data](https://discourse.julialang.org/t/extracting-wave-numbers-using-fft-and-2d-data/127758)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 3\
**Last updated:** [April 6, 2025, 7:13pm UTC](https://discourse.julialang.org/t/extracting-wave-numbers-using-fft-and-2d-data/127758 "2025-04-06T19:13:36Z")

</div>

Dear all, I am trying to write a basic script that extract sthe wave numbers of a 2D signal (defined in ‘spatial coordinates’) using FFTW. To test the script, I want to define a signal where the wave numbers in x and y…

---

## [FFTW scales pretty well (some @btime benchmarks)](https://discourse.julialang.org/t/fftw-scales-pretty-well-some-btime-benchmarks/28341)

<div class="topic-metadata">

**Author:** [@xzackli](https://discourse.julialang.org/u/xzackli)\
**Replies:** 1\
**Last updated:** [February 4, 2025, 2:30pm UTC](https://discourse.julialang.org/t/fftw-scales-pretty-well-some-btime-benchmarks/28341 "2025-02-04T14:30:43Z")

</div>

I was misled into thinking that FFTW scales poorly in parallel after reading this discourse thread, so I wanted to post some numbers for someone trying to do fast FFTs in the future. My use case requires repeatedly perfo…

---

## [Error building FFTW on Windows](https://discourse.julialang.org/t/error-building-fftw-on-windows/125025)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [January 22, 2025, 8:46pm UTC](https://discourse.julialang.org/t/error-building-fftw-on-windows/125025 "2025-01-22T20:46:20Z")

</div>

Any idea: ERROR: LoadError: Unable to open libLLVM! ... in expression starting at C:\\Users\\runneradmin\\.julia\\packages\\FFTW\\oepdx\\deps\\build\_fftw.jl:1 in expression starting at C:\\Users\\runneradmin\\.julia\\packages\\FFT…

---

## [Fastest Julia implementation for a cyclic convolution of real vectors](https://discourse.julialang.org/t/fastest-julia-implementation-for-a-cyclic-convolution-of-real-vectors/123665)

<div class="topic-metadata">

**Author:** [@lukemin](https://discourse.julialang.org/u/lukemin)\
**Replies:** 17\
**Last updated:** [December 12, 2024, 4:44pm UTC](https://discourse.julialang.org/t/fastest-julia-implementation-for-a-cyclic-convolution-of-real-vectors/123665 "2024-12-12T16:44:03Z")

</div>

Hi, I am looking for the fastest way to implement the cyclic convolution of two real vectors. In other words, given some positive integer n \> 0 which is not necessarily power-of-two, I want to multiply two degree-(n-1) …

---

## [FFT with @view](https://discourse.julialang.org/t/fft-with-view/123137)

<div class="topic-metadata">

**Author:** [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)\
**Replies:** 4\
**Last updated:** [November 29, 2024, 2:09am UTC](https://discourse.julialang.org/t/fft-with-view/123137 "2024-11-29T02:09:37Z")

</div>

I want to do fft and want to write the result on a predefined array. However, there is a problem with this when the source and target arrays are both views: using FFTW, LinearAlgebra M = randn(100,100,100) C = @view M\[:…

---

## [Replacing FFT from Numerical Recipes with FFTW](https://discourse.julialang.org/t/replacing-fft-from-numerical-recipes-with-fftw/55508)

<div class="topic-metadata">

**Author:** [@edwinb-ai](https://discourse.julialang.org/u/edwinb-ai)\
**Replies:** 8\
**Last updated:** [August 11, 2024, 12:03pm UTC](https://discourse.julialang.org/t/replacing-fft-from-numerical-recipes-with-fftw/55508 "2024-08-11T12:03:17Z")

</div>

Hello there. I’m tasked to port an old FORTRAN 77 legacy code to Julia. Unfortunately, I’m stuck with the computation of a Fast Fourier Transform (FFT). The original legacy code uses the sinft routine from the Numerica…

---

## [FFTW x 2 = symbol lookup error](https://discourse.julialang.org/t/fftw-x-2-symbol-lookup-error/117528)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 8\
**Last updated:** [July 26, 2024, 10:47pm UTC](https://discourse.julialang.org/t/fftw-x-2-symbol-lookup-error/117528 "2024-07-26T22:47:04Z")

</div>

I have a package that uses FFTW (via FastTransforms). A user is trying to load it in python (via PythonCall), along with any one of various other python packages that also use FFTW. Apparently, the latter include share…

---

## [Segmentation Fault with FFTW plans and multi-threading](https://discourse.julialang.org/t/segmentation-fault-with-fftw-plans-and-multi-threading/116777)

<div class="topic-metadata">

**Author:** [@leonardromano](https://discourse.julialang.org/u/leonardromano)\
**Replies:** 1\
**Last updated:** [July 8, 2024, 3:47pm UTC](https://discourse.julialang.org/t/segmentation-fault-with-fftw-plans-and-multi-threading/116777 "2024-07-08T15:47:14Z")

</div>

I am trying to optimize a routine that performs FFTs on timeseries of various 3D boxes with fixed but different sizes (typically 256 - 512 cells per dimension). For each box I thus had in mind to plan an FFT using FFTWs…

---

## [FFT scaling. Matlab vs. Julia](https://discourse.julialang.org/t/fft-scaling-matlab-vs-julia/116404)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [June 30, 2024, 11:25pm UTC](https://discourse.julialang.org/t/fft-scaling-matlab-vs-julia/116404 "2024-06-30T23:25:08Z")

</div>

Matlab documentation states and I am puzzled by this. (i) Why doesn’t fft() do this scaling internally? I have to do X = (1/L)\*fft(x,N);% Now we compute the coefficients X\_k in order to get the correct spectrum…

---

## [Repurposing memory fragments of a large arrays](https://discourse.julialang.org/t/repurposing-memory-fragments-of-a-large-arrays/116090)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 9\
**Last updated:** [June 22, 2024, 9:46pm UTC](https://discourse.julialang.org/t/repurposing-memory-fragments-of-a-large-arrays/116090 "2024-06-22T21:46:11Z")

</div>

I have some code, which allocates a larger array, which I store in a named tuple along with other pre-allocated arrays. To save memory, I would like to re-purpose this array tmp\_cpx to “host” two smaller arrays, since th…

---

## [Frequency-wavenumber spectrum?](https://discourse.julialang.org/t/frequency-wavenumber-spectrum/115821)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 7\
**Last updated:** [June 20, 2024, 1:55pm UTC](https://discourse.julialang.org/t/frequency-wavenumber-spectrum/115821 "2024-06-20T13:55:06Z")

</div>

Hi everyone. I have some 2D data in time and space. I am trying to do some Frequency-wavenumber analysis. Anyone has a code to compute the proper Frequency-wavenumber spectrum? Let me know. Kind regards. M.

---

## [How to avoid memory blow up with FFT without expensive garbage collection?](https://discourse.julialang.org/t/how-to-avoid-memory-blow-up-with-fft-without-expensive-garbage-collection/115400)

<div class="topic-metadata">

**Author:** [@singularity](https://discourse.julialang.org/u/singularity)\
**Replies:** 3\
**Last updated:** [June 10, 2024, 7:55pm UTC](https://discourse.julialang.org/t/how-to-avoid-memory-blow-up-with-fft-without-expensive-garbage-collection/115400 "2024-06-10T19:55:33Z")

</div>

I am trying to write a code that has a for loop inside which an array is broken into chunks, sent to multiple processors, and FFT is performed on those chunks. Without using garbage collection GC.gc() command at the end …

---

## [Updating CUDA seems to have completely broken the package](https://discourse.julialang.org/t/updating-cuda-seems-to-have-completely-broken-the-package/110101)

<div class="topic-metadata">

**Author:** [@Hareruya](https://discourse.julialang.org/u/Hareruya)\
**Replies:** 3\
**Last updated:** [April 14, 2024, 11:36pm UTC](https://discourse.julialang.org/t/updating-cuda-seems-to-have-completely-broken-the-package/110101 "2024-04-14T23:36:36Z")

</div>

Salutations, I am currently a PhD student and defended my thesis last month. Most of my Master’s research and all of my PhD research were developed using julia. I decided to update julia and run my old code at which poi…

---

## [How to Filter 2D Fourier Coefficients](https://discourse.julialang.org/t/how-to-filter-2d-fourier-coefficients/112108)

<div class="topic-metadata">

**Author:** [@balancedflow](https://discourse.julialang.org/u/balancedflow)\
**Replies:** 15\
**Last updated:** [March 27, 2024, 10:57pm UTC](https://discourse.julialang.org/t/how-to-filter-2d-fourier-coefficients/112108 "2024-03-27T22:57:45Z")

</div>

I have a real 2D Array (Nx,Ny) of some variable, let’s say absolute vorticity. I perform a 2d fft on the matrix by: fc\_2d = FFTW.r2r(arr,FFTW.R2HC) which returns a 2d matrix of the same size of Fourier coefficients. I…

---

## [Error in FastTransforms.jl for cheb2leg](https://discourse.julialang.org/t/error-in-fasttransforms-jl-for-cheb2leg/108995)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 1\
**Last updated:** [January 22, 2024, 10:20pm UTC](https://discourse.julialang.org/t/error-in-fasttransforms-jl-for-cheb2leg/108995 "2024-01-22T22:20:31Z")

</div>

I’m working with Legendre transforms and according to FastTransforms.jl, one can do a Chebyshev Transform and use the cheb2leg() function to transform from Chebyshev coefficients to Legendre coefficients. I’ve compared …

---

## [FFTW with @parallel seg faults](https://discourse.julialang.org/t/fftw-with-parallel-seg-faults/10590)

<div class="topic-metadata">

**Author:** [@mzilhao](https://discourse.julialang.org/u/mzilhao)\
**Replies:** 7\
**Last updated:** [January 11, 2024, 3:47pm UTC](https://discourse.julialang.org/t/fftw-with-parallel-seg-faults/10590 "2024-01-11T15:47:05Z")

</div>

hi all, I have a code that I’m trying to trivially parallelize with @parallel, but I’m getting a strange segmentation fault that I’ve tracked down to a call to FFTW.plan\_r2r. This is the simplest example that reproduces…

---

## [Chebyshev Transform using FFTW and FastTransforms.jl Speed](https://discourse.julialang.org/t/chebyshev-transform-using-fftw-and-fasttransforms-jl-speed/107387)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 6\
**Last updated:** [December 16, 2023, 6:18pm UTC](https://discourse.julialang.org/t/chebyshev-transform-using-fftw-and-fasttransforms-jl-speed/107387 "2023-12-16T18:18:38Z")

</div>

I’m looking into spectral methods for some PDEs. For the discrete Chebyshev Transform, it is basically a discrete cosine transform: I’ve looked at FastTransforms.jl as they have a Chebyshev Transform which can be used…

---

## [About In-line-fft](https://discourse.julialang.org/t/about-in-line-fft/105340)

<div class="topic-metadata">

**Author:** [@Take1234](https://discourse.julialang.org/u/Take1234)\
**Replies:** 6\
**Last updated:** [October 24, 2023, 12:32pm UTC](https://discourse.julialang.org/t/about-in-line-fft/105340 "2023-10-24T12:32:07Z")

</div>

Hi Experts ,I’m just studing Julia But I’m in truble. Berrow 2D turblence simulation code is that I translated from Matlab is use too much memory. At my Simulation environment it use approx. 32 GB. I found some info abou…

---

## [FFT convolution heat equation](https://discourse.julialang.org/t/fft-convolution-heat-equation/103681)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 7\
**Last updated:** [September 13, 2023, 5:32am UTC](https://discourse.julialang.org/t/fft-convolution-heat-equation/103681 "2023-09-13T05:32:51Z")

</div>

Hello, I am looking at the heat equation \\partial\_t u(x,t) = \\alpha \\partial^2\_{x} u(x,t) on \\mathbb{R} with initial condition u(x,0) = f(x) The analytical solution is given by u(x,t) = G \\star f, where G(x,t) = \\frac{…

---

## [CUDA fft wrapper problem](https://discourse.julialang.org/t/cuda-fft-wrapper-problem/29540)

<div class="topic-metadata">

**Author:** [@Michael\_Benton](https://discourse.julialang.org/u/Michael_Benton)\
**Replies:** 1\
**Last updated:** [August 24, 2023, 12:56pm UTC](https://discourse.julialang.org/t/cuda-fft-wrapper-problem/29540 "2023-08-24T12:56:29Z")

</div>

A 1d fft across the 2nd dimension of 3 dimensional CuArray is not enabled by the wrapper (ERROR: ArgumentError: batching dims must be sequential) to reproduce: dim = 2 data = CuArrays.rand(ComplexF32,512,512,512); my…

---

## [Is multithreaded FFTW on multiple arrays causing too much overhead?](https://discourse.julialang.org/t/is-multithreaded-fftw-on-multiple-arrays-causing-too-much-overhead/102832)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 15\
**Last updated:** [August 19, 2023, 6:04pm UTC](https://discourse.julialang.org/t/is-multithreaded-fftw-on-multiple-arrays-causing-too-much-overhead/102832 "2023-08-19T18:04:19Z")

</div>

I have a couple of matrices that I have FFT to computer a nonlinear function and then IFFT. My question: Is using a multithreaded FFT plan creating too much overhead because of each instance the FFTW is called? Is there…

---

## [Saving FFTW plans for future use](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 2\
**Last updated:** [August 16, 2023, 5:47pm UTC](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871 "2023-08-16T17:47:31Z")

</div>

Is there anyway to save and load FFTW plans? For example: using FFTW sz = 2^13 ar = rand(ComplexF64,(sz,sz)); pthread =FFTW.plan\_fft!(ar,flags=FFTW.MEASURE); inv(pthread); pthreadpatient =FFTW.plan\_fft!(ar,flags=FFTW.…

---

## [Type stability around of wrapped plan fft](https://discourse.julialang.org/t/type-stability-around-of-wrapped-plan-fft/102582)

<div class="topic-metadata">

**Author:** [@Veenty](https://discourse.julialang.org/u/Veenty)\
**Replies:** 2\
**Last updated:** [August 8, 2023, 7:27am UTC](https://discourse.julialang.org/t/type-stability-around-of-wrapped-plan-fft/102582 "2023-08-08T07:27:43Z")

</div>

I have a simple struct wrapping a planned fft and I’m not really sure how to make it type stable I might need to write the type of the fft, but I’m not really sure how to do it (I cannot really interpret the type of a p…

---

## [FFTW.jl support fftw\_plan\_many\_dft?](https://discourse.julialang.org/t/fftw-jl-support-fftw-plan-many-dft/102466)

<div class="topic-metadata">

**Author:** [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Replies:** 6\
**Last updated:** [August 6, 2023, 4:52pm UTC](https://discourse.julialang.org/t/fftw-jl-support-fftw-plan-many-dft/102466 "2023-08-06T16:52:08Z")

</div>

Hi - I have a scenario where I’m working with a large number of 3d arrays and want to efficiently calculate FFT’s for each column. I’ve written a few test functions that iterate in various ways across columns in calcula…

---

## [FFTW multithreading and plans](https://discourse.julialang.org/t/fftw-multithreading-and-plans/67592)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 3\
**Last updated:** [July 11, 2023, 5:10pm UTC](https://discourse.julialang.org/t/fftw-multithreading-and-plans/67592 "2023-07-11T17:10:44Z")

</div>

Hi folks, I have a question regarding FFTW transforms, planning them, and multithreading to speed that up. In particular I lunch julia --threads 4 and once in the REPL Threads.nthreads() says I’m running with 4 thread…

---

## [Thread safety of \`mul!\` in \`ToeplitzMatrices.jl\` with FFTW plan inside Factorization](https://discourse.julialang.org/t/thread-safety-of-mul-in-toeplitzmatrices-jl-with-fftw-plan-inside-factorization/100068)

<div class="topic-metadata">

**Author:** [@adomasbaliuka](https://discourse.julialang.org/u/adomasbaliuka)\
**Replies:** 6\
**Last updated:** [June 9, 2023, 7:20am UTC](https://discourse.julialang.org/t/thread-safety-of-mul-in-toeplitzmatrices-jl-with-fftw-plan-inside-factorization/100068 "2023-06-09T07:20:23Z")

</div>

The creation of FFTW plans is not threadsafe https://discourse.julialang.org/t/fftw-plans-for-multiple-threads/21861. (Or is it?) However, if the plan is pre-allocated, that should be thread safe? I want to pre-compute a…

[Next page](https://discourse.julialang.org/tag/fftw/19.md?match_all_tags=true&page=1&tags%5B%5D=fftw)
