## simpleFFT simpleFFT — Simple FFT algorithm |

## Functions

void | gwy_fft_simple ()
void | gwy_fft_window ()
void | gwy_fft_window_data_field ()

## Includes

    #include <libprocess/gwyprocess.h>

## Description

The simple one-dimensional FFT algorithm `gwy_fft_simple()` used to be employed as a fallback by other functions when a better implementation (FFTW3) was not available. Since version 2.49 it just calls the corresponding FFTW routine.

Generally, you should either use high-level Gwyddion functions such as `gwy_data_field_2dfft_raw()` or, if they are insufficient, FFTW routines directly.

Up to version 2.7 simpleFFT required certain tranform sizes, mostly powers of 2. Since 2.8 it can handle arbitrary tranform sizes, although sizes with large prime factors can be quite slow (still O(n*log(n)) though).

## Functions

### gwy_fft_simple ()

    void
    gwy_fft_simple (GwyTransformDirection dir,
                    gint n,
                    gint istride,
                    const gdouble *in_re,
                    const gdouble *in_im,
                    gint ostride,
                    gdouble *out_re,
                    gdouble *out_im);

Performs a DFT algorithm.

This is a low-level function that used to be employed by other FFT functions when no better backend was available. Since version 2.49 it just calls the corresponding FFTW routine.

Strides are distances between samples in input and output arrays. Use 1 for normal `dense' arrays. To use `gwy_fft_simple()` with interleaved arrays, that is with alternating real and imaginary data, call it with `istride` =2, `in_re` =`complex_array` , `in_im` =`complex_array` +1 (and similarly for output arrays).

The output is symmetrically normalized by square root of `n` for both transform directions. By performing forward and then backward transform, you will obtain the original array (up to rounding errors).

#### Parameters

dir | Transformation direction. |
n | Number of data points. Note only certain transform sizes are implemented. If `gwy_fft_simple()` is the current FFT backend, then `gwy_fft_find_nice_size()` can provide accepted transform sizes. If `gwy_fft_simple()` is not the current FFT backend, you should not use it. |
istride | Input data stride. |
in_re | Real part of input data. |
in_im | Imaginary part of input data. |
ostride | Output data stride. |
out_re | Real part of output data. |
out_im | Imaginary part of output data. |

### gwy_fft_window ()

    void
    gwy_fft_window (gint n,
                    gdouble *data,
                    GwyWindowingType windowing);

Multiplies data by given window.

#### Parameters

n | Number of data values. |
data | Data values. |
windowing | Method used for windowing. |

### gwy_fft_window_data_field ()

    void
    gwy_fft_window_data_field (GwyDataField *dfield,
                               GwyOrientation orientation,
                               GwyWindowingType windowing);

Performs windowing of a data field in given direction.

#### Parameters

dfield | A data field. |
orientation | Windowing orientation (the same as corresponding FFT orientation). |
windowing | The windowing type to use. |

## See Also

inttrans -- high-level integral transform functions