FFT Class Reference

#include <fft.h>


Static Public Member Functions

static void discrete (double *data, ushort size, int isign)
 Takes a given complex double array and replaces it with its Discrete Fourier Transform.
static void swap (double *data, ushort x, ushort y)
 Swaps the vales of data[x] and data[y].
static void twofft (double *data1, double *data2, double *fft1, double *fft2, ushort size)
 Performs the DFT of 2 real arrays simultaneously.
static void convolve (double *R, ushort Rsize, double *S, ushort Ssize, int isign, double *result, double *dummy)
 Convolves 2 functions.
static void realfft (double *data, ushort complexSize, int isign)
 Performs a DFT on a real array of data.
static void ndim_discrete (double *data, unsigned long *nn, int ndim, int isign)
 Takes data and replaces it with it's N-Dimensional Discrete Fourier Transform.
static double * pad (double *array, int N)
 Pads the given array up to the next power of 2 with zeros.
static double * unpad (double *array, int N)
 Unpads the given array down to the next lower power of 2.


Member Function Documentation

void FFT::convolve ( double *  R,
ushort  Rsize,
double *  S,
ushort  Ssize,
int  isign,
double *  result,
double *  dummy 
) [static]

Convolves 2 functions.

S is the "signal" function and R is the "Response" function.

References realfft(), and twofft().

void FFT::discrete ( double *  data,
ushort  nn,
int  isign 
) [static]

Takes a given complex double array and replaces it with its Discrete Fourier Transform.

size is size of COMPLEX components, thus size of array(data) must be 2*size.

Parameters:
data double complex array of size 2*size.
size number of COMPLEX NUMBERS
isign 1 for Fourier Transform, -1 for inverse transform
eg 4 complex numbers has size = 4 and data[1..8]

also the first data element in data is data[1]; don't ask me why. This can be worked around. If the zeroth value of the array is the beginning of the data(ie data[0]...data[2*nn-1]) then call the function with discrete(pdata - 1, size, isign) isign is the sign of i in the transform(either 1 or -1)

The Result is not normalized. The normalization constant is the square root of the number of samples for transform and number of samples for inverse

References swap().

Referenced by realfft(), and twofft().

void FFT::ndim_discrete ( double *  data,
unsigned long *  nn,
int  ndim,
int  isign 
) [static]

Takes data and replaces it with it's N-Dimensional Discrete Fourier Transform.

Parameters:
data array of size ndim*max(nn)*2. The resulting data is a complex array.
nn Unsigned Long Array containing the complex length of each dimension. Each must be a power of 2.
ndim int size of nn array.
isign. 1 for Fourier Transform, -1 for Inverse Fourier Transform.

Referenced by main().

double * FFT::pad ( double *  array,
int  N 
) [static]

Pads the given array up to the next power of 2 with zeros.

Parameters:
array array of size N.
N int size of array.
Returns:
double * size of new array is the next power of 2 above N

On each side

void FFT::realfft ( double *  data,
ushort  complexSize,
int  isign 
) [static]

Performs a DFT on a real array of data.

See also:
void discrete()

References discrete(), and pi.

Referenced by convolve().

void FFT::swap ( double *  data,
ushort  x,
ushort  y 
) [static]

Swaps the vales of data[x] and data[y].

Parameters:
data double array
x element to switch
y element to switch

Referenced by discrete().

void FFT::twofft ( double *  data1,
double *  data2,
double *  fft1,
double *  fft2,
ushort  size 
) [static]

Performs the DFT of 2 real arrays simultaneously.

In this case, unlike discrete(...), the fft values do not replace the original data. Instead, arrays must be supplied as parameters to store the results.

Parameters:
data1 real double array
data2 real double array
fft1 complex double array FFT of data1
fft2 complex double array FFT of data2
size integer size of data1 and data2 (# of complex numbers in fft1 and fft2)
See also:
void discrete()

References discrete().

Referenced by convolve().

double * FFT::unpad ( double *  array,
int  N 
) [static]

Unpads the given array down to the next lower power of 2.

Parameters:
array array of size N.
N int size of array.
Returns:
double * size of new array is the next lower power of 2 below N

On each side


The documentation for this class was generated from the following files:

Generated on Sat Feb 6 13:06:19 2010 by  doxygen 1.5.7.1