simplefft

simplefft — Simple FFT algorithm

Synopsis


#include <libprocess/gwyprocess.h>


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);
void                gwy_fft_window                      (gint n,
                                                         gdouble *data,
                                                         GwyWindowingType windowing);
void                gwy_fft_window_data_field           (GwyDataField *dfield,
                                                         GwyOrientation orientation,
                                                         GwyWindowingType windowing);

Description

The simple one-dimensional FFT algorithm gwy_fft_simple() is used as a fallback by other functions when better implementation (FFTW3) is not available.

It works only on data sizes that are powers of 2.

Details

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 used by other FFT functions when no better backend is available.

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).

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.

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.

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