# Newbie to cuFFT - how to do real-to-real transforms

**URL:** <https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952>\
**Category:** GPU-Accelerated Libraries\
**Created:** [January 29, 2019, 7:02pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952 "2019-01-29T19:02:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhaney](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@rhaney](https://forums.developer.nvidia.com/u/rhaney)\
**Post date:** [January 29, 2019, 7:02pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/1 "2019-01-29T19:02:38Z")

</div>

Good Afternoon,

I am familiar with CUDA but not with cuFFT and would like to perform a real-to-real transform. I found information on Complex-to-Complex and Complex-to-Real (CUFFT\_C2C and CUFFT\_C2R). Can anyone help a cuFFT newbie on how to perform a Real-to-Real transform using cuFFT? Some simple, beginner code would be great if possible.

Thank you in advanced for any assistance.

---

<div class="post-metadata">

**Author:** ![saulocpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@saulocpp](https://forums.developer.nvidia.com/u/saulocpp)\
**Post date:** [January 29, 2019, 10:58pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/2 "2019-01-29T22:58:44Z")

</div>

You didn’t mention what you want to do next, so I assume (maybe incorrectly) that what you want is a complex to complex transform.  
I spent weeks/months using the R2C and C2R and wondered why I never got meaningful results out of it after operating the elements. The R2C/C2R transforms exploit the hermitian symmetry to calculate the transform outputting just half+1 elements. However, the moment I manipulated these elements, I broke the symmetry, thus messing up the inverse transform.

Then I learned here that what I really needed was the C2C so it would work like how we learn from the books (and as Matlab and Octave work, in case you use these). No, you will not start by providing a complex input (like I imagined), because that’s what you want from the transform.  
Please search the threads (it is very recent) and you will find it. It has a complete and working code, corrected by Robert Crovella and I think you will understand in a few minutes.

And you really have to spend time reading and re-reading the documentation.

---

<div class="post-metadata">

**Author:** ![rhaney](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@rhaney](https://forums.developer.nvidia.com/u/rhaney)\
**Post date:** [January 30, 2019, 1:37pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/3 "2019-01-30T13:37:15Z")

</div>

Thank you @saulocpp for the response. You are correct, I should have been more clear with what I am trying to accomplish. I am simply looking for a way to execute Real-to-Real, no complex value(s) needed. I just wanted to see if there was a CUFFT\_R2R call somewhere in cuFFT before I went into building one from scratch.

Thanks again.

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [January 31, 2019, 3:39pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/4 "2019-01-31T15:39:03Z")

</div>

There is no R2R call in CUFFT.

CUFFT supports ordinary DFT’s using the FFT methodology. The forward version of these transforms all produce complex (i.e. not purely real) data

What FFTW calls a R2R transform is really one of a subset of 3 special cases:

[url][http://www.fftw.org/fftw3\_doc/More-DFTs-of-Real-Data.html[/url]](http://www.fftw.org/fftw3_doc/More-DFTs-of-Real-Data.html%5B/url%5D)

The first of these 3 is simply the CUFFT R2C transform:

[url][The Halfcomplex-format DFT (FFTW 3.3.10)](http://www.fftw.org/fftw3_doc/The-Halfcomplex_002dformat-DFT.html#The-Halfcomplex_002dformat-DFT%5B/url%5D)

The other 2 are not directly supported by CUFFT. As pointed out in the FFTW docs, these are computed (by FFTW) using the R2C transform data.

---

<div class="post-metadata">

**Author:** ![christophernhill](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@christophernhill](https://forums.developer.nvidia.com/u/christophernhill)\
**Post date:** [February 19, 2019, 5:22pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/5 "2019-02-19T17:22:05Z")

</div>

Bob,

Following up on your “As pointed out in the FFTW docs, these are computed (by FFTW) using the R2C transform data” comment. Do you have any example code that illustrates this. I suspect a lot of people get frustrated having to implement this. It would be great if there were some NVidia code for this, especially since it is not an issue on x86 platforms. There the code is readily available and you just use the library on Intel platforms.

Is there any chance Nvidia could think about providing something similar?

Thanks,

Chris

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [February 19, 2019, 6:21pm UTC](https://forums.developer.nvidia.com/t/newbie-to-cufft-how-to-do-real-to-real-transforms/69952/6 "2019-02-19T18:21:51Z")

</div>

As far as I know, FFTW is open source. That means the implementation should be discoverable. The process of converting FFTW calls to CUFFT calls e.g. R2C transform is fairly mechanical.

If you’d like to see something in CUDA, my recommendation is to file a bug at [developer.nvidia.com](http://developer.nvidia.com)
