cancel
Showing results for
Search instead for
Did you mean:

# OpenCL

Journeyman III

## convolution of real data using clAmdFft

Jump to solution

Hello,

I want to perform a convolution with the clAmdFft library (by the way: good work!). The input data and the convolution kernel are both real.

The general procedure is:

transform input A

transform kernel B

multiply the results componentwise

transform back the product

in words: A o B = iFT[FT * FT]

I've implemented it with complex-to-complex (C2C) transformations only and it works fine. The resulting convolution is real data only. Because I have also other operations (kernels) dealing with the input data, I have to expand the buffer A from real to complex then convolve it and then reduce the results from complex to real. This looks somewhat unnecessary for me ...

Here's the question: Do I have to perform a complex-to-complex FFT in the convolution algorithm? Or might it be sufficient to use real-to-complex (R2C) transformation for A and B, gaining hermitian data and then use complex-to-real (C2R) for inverse transforming the componentwise product? I.e.:

A o B = iC2R_FT[R2C_FT * R2C_FT]

1 Solution

Accepted Solutions
Staff

## Re: convolution of real data using clAmdFft

Jump to solution

Hi,

You can do this using real FFTs, and your formula should work. The complex FFTs have better performance at larger sizes than the real FFTs. Not much effort has gone into optimizing real FFTs at larger sizes. But at smaller sizes (less than 4096 length at 1D)  real FFTs are better.

1 Reply
Staff

## Re: convolution of real data using clAmdFft

Jump to solution

Hi,

You can do this using real FFTs, and your formula should work. The complex FFTs have better performance at larger sizes than the real FFTs. Not much effort has gone into optimizing real FFTs at larger sizes. But at smaller sizes (less than 4096 length at 1D)  real FFTs are better.