XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ rfft2f()

void rfft2f ( int  l,
int  m,
int  ldr,
double  r[],
double  wsave[],
int  lwsave,
double  work[],
int  lwork,
int *  info 
)

Two-dimensional real Fourier transform

Purpose
rfft2f computes the two-dimensional Fourier transform of a periodic sequence within a real array. This is referred to as the forward transform or Fourier analysis, transforming the sequence from physical to spectral space. The full complex transform is given by:
c[k][j] = (1/lm)ΣΣr[m1][l1]exp(-2π*i(j*l1/l+k*m1/m)) (1st Σ for l1 = 0 to l-1, 2nd Σ for m1 = 0 to m-1) (j = 0 to l-1, k = 0 to m-1) (i is imaginary unit)
This transform is normalized since a call to rfft2f followed by a call to rfft2b (or vice-versa) reproduces the original array subject to algorithmic constraints, roundoff error, etc.
Parameters
[in]lThe number of elements to be transformed in the first dimension of the two-dimensional data array. (l >= 1)
The transform is most efficient when l is a product of small primes.
[in]mThe number of elements to be transformed in the second dimension of the two-dimensional data array. (m >= 1)
The transform is most efficient when m is a product of small primes.
[in]ldrLeading dimension of two dimensional array r[][]. (ldr >= l)
[in,out]r[]Array r[lr][ldr] (lr >= m)
[in] The two dimensional real sequence data to be transformed.
[out] The Fourier forward transformed two dimensional complex sequence data c(i,j) (i = 0 to l-1, j = 0 to m-1).
  The complex transform of the real sequence data has conjugate symmetry. That is, c(i,j) = conj(c(l-i,m-j)), so only half the transform is computed and packed back into the original array r[] as shown in the examples below.
[in]wsave[]Array wsave[lwsave]
Work data. Its contents must be initialized with a call to rfft2i before the first call to rfft2f or rfft2b for a given transform length n.
[in]lwsaveThe length of the array wsave[]. (lwsave >= l+3m+ln(l)/ln(2)+2ln(m)/ln(2)+12)
[out]work[]Array work[lwork]
Work array.
[in]lworkThe length of the array work[]. (lwork >= (l + 1)*m)
[out]info= 0: Successful exit
= -1: The argument l had an illegal value (l < 1)
= -2: The argument m had an illegal value (m < 1)
= -3: The argument ldr had an illegal value (ldr < l)
= -6: The argument lwsave had an illegal value (lwsave not big enough)
= -8: The argument lwork had an illegal value (lwork not big enough)
Further Details
Let a(i,j) = re(c(i,j)) and b(i,j) = im(c(i,j)), then the packed data of the forward transform are stored in r[][] as following examples:
l = m = 4
a(0,0)* a(0,1) b(0,1) a(0,2)*
r[][] = a(1,0) a(1,1) a(1,2) a(1,3)
b(1,0) b(1,1) b(1,2) b(1,3)
a(2,0)* a(2,1) b(2,1) a(2,2)*
l = m = 5
a(0,0)* a(0,1) b(0,1) a(0,2) b(0,2)
a(1,0) a(1,1) a(1,2) a(1,3) a(1,4)
r[][] = b(1,0) b(1,1) b(1,2) b(1,3) b(1,4)
a(2,0) a(2,1) a(2,2) a(2,3) a(2,4)
b(2,0) b(2,1) b(2,2) b(2,3) b(2,4)
*: Imaginary part = 0
The remaining c(i,j) for i = (l+1)/2 to l-1 and j = 0 to m-1 can be obtained via the conjugate symmetry. For even l, c(l/2,j) = conj(c(l/2,m-j).
Reference
FFTPACK 5.1