SourcePro® API Reference Guide

 
List of all members | Public Member Functions
DoubleFFTServer Class Reference

Performs double precision complex fast Fourier transforms (FFTs) of a real vector. More...

#include <rw/dfft.h>

Inheritance diagram for DoubleFFTServer:
DComplexFFTServer DoubleCosineServer

Public Member Functions

 DoubleFFTServer ()
 
 DoubleFFTServer (size_t oforder)
 
 DoubleFFTServer (const DoubleFFTServer &)
 
RWMathVec< DComplexfourier (const RWMathVec< double > &v)
 
RWMathVec< double > ifourier (const RWMathVec< DComplex > &v)
 
DoubleFFTServeroperator= (const DoubleFFTServer &v)
 
size_t order () const
 
void setOrder (size_t N)
 

Additional Inherited Members

- Private Member Functions inherited from DComplexFFTServer
 DComplexFFTServer ()
 
 DComplexFFTServer (size_t order)
 
 DComplexFFTServer (const DComplexFFTServer &)
 
RWMathVec< DComplexfourier (const RWMathVec< DComplex > &v)
 
RWMathVec< DComplexifourier (const RWMathVec< DComplex > &v)
 
DComplexFFTServeroperator= (const DComplexFFTServer &v)
 
size_t order () const
 
void setOrder (size_t N)
 

Detailed Description

Class DoubleFFTServer performs double precision complex fast Fourier transforms (FFTs) of a real vector.

At any given moment, the server is configured to transform a real vector of a specified length. This length can be set one of three ways:

If you use the last method, the server automatically reconfigures to the new length if the vector length changes. This is an expensive calculation. Hence, it is most efficient to call this method repeatedly for series of the same length. Different FFT servers may be constructed to handle different lengths.

The real vector must have an even number of points.

Let V(j), j=0, 1, ..., 2N-1 be a 2N point long real sequence. Its transform is a complex conjugate-even sequence, that is:

C(n) = conj[C(-n)]

or:

C(n) = conj[C(2N - n)].

The function fourier() returns the lower half of this complex conjugate-even sequence, that is, C(n), n=0, ..., N. The upper half can be recovered from the relationship C(n) = conj[C(2N-n)]. Note that the returned complex conjugate-even sequence C(n) has N+1 complex points, or a total of 2N+2 numbers. The two extra numbers are the imaginary parts of C(0) and C(N), which are always 0.

The forward transform calculated is:

\[ C(n) = \displaystyle\sum_{j=0}^{2N-1}V(j)exp\left(\frac{-i \pi nj}{2N}\right); \quad n=0, \quad .., \quad 2N-1 \]

The inverse Fourier transform calculated is:

\[ V(j) = \displaystyle\sum_{n=0}^{2N-1}C(n)exp\left(\frac{i \pi nj}{2N}\right); \quad j=0, \quad .., \quad 2N-1 \]

where V is real and C is complex. Note that only points C(n), n=0, ..., N should be given. Also note that the sum is not normalized; a call to fourier() followed by a call to ifourier() results in the original series multiplied by 2N.

Synopsis
#include <rw/dfft.h>

Constructor & Destructor Documentation

DoubleFFTServer::DoubleFFTServer ( )

Constructs a double precision FFT server for a vector of unspecified length. This length is initialized when the server is used.

DoubleFFTServer::DoubleFFTServer ( size_t  oforder)

Constructs a double precision FFT server designed to transform a vector of length oforder.

DoubleFFTServer::DoubleFFTServer ( const DoubleFFTServer )

Copy constructor. The new server references the old server's data.

Member Function Documentation

RWMathVec<DComplex> DoubleFFTServer::fourier ( const RWMathVec< double > &  v)

Returns the FFT of a real vector of 2N points. The expression:

std::cout << f.fourier(v);

prints the Fourier transform of v as a complex conjugate-even sequence of N+1 complex numbers.

RWMathVec<double> DoubleFFTServer::ifourier ( const RWMathVec< DComplex > &  v)

Returns the inverse FFT of a complex conjugate-even sequence of N+1 complex numbers as a real sequence of 2N points. The expression

std::cout << f.fourier(v);

prints the inverse Fourier transform of v as an RWMathVec<double> vector.

DoubleFFTServer& DoubleFFTServer::operator= ( const DoubleFFTServer v)

Sets self to the same order as v.

size_t DoubleFFTServer::order ( ) const
inline

Returns the order of an FFT server, that is, the vector length it is currently configured to transform.

void DoubleFFTServer::setOrder ( size_t  N)

Resets the order of an FFT server to N.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.