In-place real to complex FFT without padding

I would like to perform in-place real to complex FFT without any extra padding, i.e. if I have a real valued volume of size 128 x 128 x 128 with floats, I want to get a complex valued 128 x 128 x 128 volume with cufftComplex, without doing any extra padding. Why is this not supported in the CUFFT library? It should be possible to choose if you want the redundant coefficients or not.

“For real‐to‐complex FFTs, the output array holds only the nonredundant
complex coefficients. So for an N‐element transform, the
output array holds N/2+1 cufftComplex terms. For higher dimensional
real transforms of the form N0×N1×…×Nn, the last
dimension is cut in half such that the output data is N0×N1×…×(Nn/
2+1) complex elements. Therefore, in order to perform an in‐place
FFT, the user has to pad the input array in the last dimension to (Nn/
2+1) complex elements or 2*(N/2+1) real elements. Note that the
real‐to‐complex transform is implicitly forward.”

Why is the real-to-complex transform implicitly forward? For example quadrature filters are real valued in the frequency domain but complex valued in the spatial domain…

An upcoming version of CUFFT is slated to support several new application-selectable padding modes, which should address most of what you’re asking about here.

For the “implicitly forward” part of your question: it’s an interesting concept that you can usefully do real-to-complex from the frequency plane. Since frequency domain data with no phase information has no meaning, the case you’re talking about would be one where all phase information can be assumed to be zero. This optimization is not supported in cufft simply because it’s such a special case.


You could use a method (2 actually) described in Numerical Recipes in C.