An additional purpose of these definitions is to overload the functions so that C++ users can access the functions in either fftpak (single precision) or dfftpack (double precision) with identical function names.
These routines only do one-dimensional transforms with the first element of
the array being the "origin" of the transform. The
You must initialise the work array wsave before using the forward
transform (function with a suffix of f) or the backward transform (with a
suffix of b).
The transforms done by the functions in this class can be categorised as
follows:
Input parameter:
cfftf computes the forward complex discrete Fourier
transform (the Fourier analysis). Equivalently, cfftf computes
the Fourier coefficients of a complex periodic sequence.
the transform is defined below at output parameter c.
The transform is not normalized. To obtain a normalized transform
the output must be divided by n. Otherwise a call of cfftf
followed by a call of cfftb will multiply the sequence by n.
The array wsave which is used by cfftf must be
initialized by calling cffti(n,wsave).
Input parameters:
cfftb computes the backward complex discrete Fourier
transform (the Fourier synthesis). Equivalently, cfftb computes
a complex periodic sequence from its Fourier coefficients.
The transform is defined below with output parameter c.
A call of cfftf followed by a call of cfftb will multiply the
sequence by n.
The array wsave which is used by cfftb must be
initialized by calling cffti(n,wsave).
Input parameters:
rffti initializes the array wsave which is used in both rfftf and
rfftb. The prime factorization of n together with a tabulation of
the trigonometric functions are computed and stored in wsave.
Input parameter:
rfftf computes the Fourier coefficients of a real perodic sequence (Fourier
analysis). The transform is defined below at output parameter r.
Input parameters:
note:
this transform is unnormalized since a call of rfftf
followed by a call of rfftb will multiply the input
sequence by n.
rfftb computes the real perodic sequence from its Fourier coefficients
(Fourier synthesis). The transform is defined below at output parameter r.
Input parameters:
note:
this transform is unnormalized since a call of rfftf
followed by a call of rfftb will multiply the input
sequence by n.
ezffti initializes the array wsave which is used in both ezfftf
and ezfftb. The prime factorization of n together with a
tabulation of the trigonometric functions are computed and stored in wsave.
Input parameter:
ezfftf computes the Fourier coefficients of a real
perodic sequence (Fourier analysis). The transform is defined
below at output parameters azero, a and b. ezfftf is a simplified
but slower version of rfftf.
Input parameters:
for n even define kmax=n/2-1
ezfftb computes a real perodic sequence from its
Fourier coefficients (Fourier synthesis). The transform is
defined below at output parameter r. ezfftb is a simplified
but slower version of rfftb.
Input parameters:
sinti initializes the array wsave which is used in
sint. The prime factorization of n together with a tabulation of
the trigonometric functions are computed and stored in wsave.
Input parameter:
sint computes the discrete Fourier sine transform
of an odd sequence x(i). The transform is defined below at
output parameter x.
sint is the unnormalized inverse of itself since a call of sint
followed by another call of sint will multiply the input sequence
x by 2*(n+1).
The array wsave which is used by sint must be
initialized by calling sinti(n,wsave).
Input parameters:
a call of sint followed by another call of
sint will multiply the sequence x by 2*(n+1).
Hence sint is the unnormalized inverse
of itself.
costi initializes the array wsave which is used in
cost. The prime factorization of n together with a tabulation of
the trigonometric functions are computed and stored in wsave.
Input parameter:
cost computes the discrete Fourier cosine transform
of an even sequence x(i). The transform is defined below at output
parameter x.
cost is the unnormalized inverse of itself since a call of cost
followed by another call of cost will multiply the input sequence
x by 2*(n-1). The transform is defined below at output parameter x.
The array wsave which is used by cost must be
initialized by calling costi(n,wsave).
Input parameters:
a call of cost followed by another call of
cost will multiply the sequence x by 2*(n-1)
hence cost is the unnormalized inverse
of itself.
sinqi initializes the array wsave which is used in both sinqf and
sinqb. The prime factorization of n together with a tabulation of
the trigonometric functions are computed and stored in wsave.
Input parameter:
sinqf computes the fast Fourier transform of quarter wave data. That is,
sinqf computes the coefficients in a sine series representation with only
odd wave numbers. The transform is defined below at output parameter x.
sinqb is the unnormalized inverse of sinqf since a call of sinqf followed by
a call of sinqb will multiply the input sequence x by 4*n.
The array wsave which is used by sinqf must be initialized by calling
sinqi(n,wsave).
Input parameters:
a call of sinqf followed by a call of
sinqb will multiply the sequence x by 4*n.
therefore sinqb is the unnormalized inverse
of sinqf.
sinqb computes the fast Fourier transform of quarter
wave data. that is, sinqb computes a sequence from its
representation in terms of a sine series with odd wave numbers.
the transform is defined below at output parameter x.
sinqf is the unnormalized inverse of sinqb since a call of sinqb
followed by a call of sinqf will multiply the input sequence x
by 4*n.
The array wsave which is used by sinqb must be
initialized by calling sinqi(n,wsave).
Input parameters:
a call of sinqb followed by a call of
sinqf will multiply the sequence x by 4*n.
Therefore sinqf is the unnormalized inverse
of sinqb.
Done by the cttfi, cfftf & cfftb functions
Done by the rffti, rfftf & rfftb functions. A simpler interface is
provided by the ezffti, ezfftf & ezfftb functions. The 'ez' functions
do not destroy the input array and provide the result in a slightly
less packed format. They are available in single precision only and
internally use the rfft functions.
Done by the sinti & sint functions. As the sine transform is its own
inverse there is no need for any distinction between forward and
backward transforms.
Done by the costi & cost functions. As the cosine transform is its own
inverse there is no need for any distinction between forward and
backward transforms.
Done by the sinqi, sinqf & sinqb functions.
Done by the cosqi, cosqf & cosqb functions.
These functions assume that it is possible to convert between AIPS++ numeric
types and those used by Fortran. That it is possible to convert between
Float & float, Double & double and Int & int.
These function also assume that a Complex array is stored as pairs of
floating point numbers, with no intervening gaps, and with the real
component first ie., [re0,im0,re1,im1, ...] so that the following
type casts work,
Complex* complexPtr;
Float* floatPtr = (Float* ) complexPtr;
and allow a Complex number to be accessed as a pair of real numbers. If this
assumption is bad then float Arrays will have to generated by copying the
complex ones. When compiled in debug mode mode the functions that require
this assumption will throw an exception (AipsError) if this assumption is
bad. Ultimately this assumption about Complex<->Float Array conversion
should be put somewhere central like Array2Math.cc.
Member Description
static void cffti(Int n, Float* wsave)
cffti initializes the array wsave which is used in both cfftf and
cfftb. The prime factorization of n together with a tabulation of
the trigonometric functions are computed and stored in wsave.
static void cffti(Int n, Double* wsave)
Output parameter:
static void cfftf(Int n, Complex* c, Float* wsave)
static void cfftf(Int n, DComplex* c, Double* wsave)
Output parameters:
c(j)=the sum from k=1,...,n of
c(k)*exp(-i*(j-1)*(k-1)*2*pi/n)
where i=sqrt(-1)
static void cfftb(Int n, Complex* c, Float* wsave)
static void cfftb(Int n, DComplex* c, Double* wsave)
Output parameters:
c(j)=the sum from k=1,...,n of
c(k)*exp(i*(j-1)*(k-1)*2*pi/n)
static void rffti(Int n, Float* wsave)
static void rffti(Int n, Double* wsave)
Output parameter:
static void rfftf(Int n, Float* r, Float* wsave)
static void rfftf(Int n, Double* r, Double* wsave)
output parameters
if n is even set l = n/2 , if n is odd set l = (n+1)/2
then for k = 2,...,l
r(2*k-2) = the sum from i = 1 to i = n of
r(i)*cos((k-1)*(i-1)*2*pi/n)
r(2*k-1) = the sum from i = 1 to i = n of
-r(i)*sin((k-1)*(i-1)*2*pi/n)
if n is even
r(n) = the sum from i = 1 to i = n of
(-1)**(i-1)*r(i)
static void rfftb(Int n, Float* r, Float* wsave)
static void rfftb(Int n, Double* r, Double* wsave)
Output parameters:
r(i) = r(1)+(-1)**(i-1)*r(n)
plus the sum from k=2 to k=n/2 of
2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)
-2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)
for n odd and for i = 1,...,n
r(i) = r(1) plus the sum from k=2 to k=(n+1)/2 of
2.*r(2*k-2)*cos((k-1)*(i-1)*2*pi/n)
-2.*r(2*k-1)*sin((k-1)*(i-1)*2*pi/n)
static void ezffti(Int n, Float* wsave)
Output parameter:
static void ezfftf(Int n, Float* r, Float* azero, Float* a, Float* b, Float* wsave)
Output parameters:
for n even
b(n/2)=0, and
a(n/2) is the sum from i=1 to i=n of (-1)**(i-1)*r(i)/n
for n odd define kmax=(n-1)/2
then for k=1,...,kmax
a(k) equals the sum from i=1 to i=n of
2./n*r(i)*cos(k*(i-1)*2*pi/n)
b(k) equals the sum from i=1 to i=n of
2./n*r(i)*sin(k*(i-1)*2*pi/n)
static void ezfftb(Int n, Float* r, Float* azero, Float* a, Float* b, Float* wsave)
Output parameters:
if n is odd define kmax=(n-1)/2
then for i=1,...,n
r(i)=azero plus the sum from k=1 to k=kmax of
a(k)*cos(k*(i-1)*2*pi/n)+b(k)*sin(k*(i-1)*2*pi/n)
where
c(k) = .5*cmplx(a(k),-b(k)) for k=1,...,kmax
c(-k) = conjg(c(k))
c(0) = azero
and i=sqrt(-1)
static void sinti(Int n, Float* wsave)
static void sinti(Int n, Double* wsave)
Output parameter:
static void sint(Int n, Float* x, Float* wsave)
static void sint(Int n, Double* x, Double* wsave)
Output parameters:
x(i) = the sum from k=1 to k=n
2*x(k)*sin(k*i*pi/(n+1))
static void costi(Int n, Float* wsave)
static void costi(Int n, Double* wsave)
Output parameter:
static void cost(Int n, Float* x, Float* wsave)
static void cost(Int n, Double* x, Double* wsave)
Output parameters:
x(i) = x(1)+(-1)**(i-1)*x(n)
+ the sum from k=2 to k=n-1
2*x(k)*cos((k-1)*(i-1)*pi/(n-1))
static void sinqi(Int n, Float* wsave)
static void sinqi(Int n, Double* wsave)
Output parameter:
static void sinqf(Int n, Float* x, Float* wsave)
static void sinqf(Int n, Double* x, Double* wsave)
Output parameters:
x(i) = (-1)**(i-1)*x(n)
+ the sum from k=1 to k=n-1 of
2*x(k)*sin((2*i-1)*k*pi/(2*n))
static void sinqb(Int n, Float* x, Float* wsave)
static void sinqb(Int n, Double* x, Double* wsave)
Output parameters:
x(i)= the sum from k=1 to k=n of
4*x(k)*sin((2k-1)*i*pi/(2*n))
static void cosqi(Int n, Float* wsave)
static void cosqi(Int n, Double* wsave)
static void cosqf(Int n, Float* x, Float* wsave)
static void cosqf(Int n, Double* x, Double* wsave)
static void cosqb(Int n, Float* x, Float* wsave)
static void cosqb(Int n, Double* x, Double* wsave)