fftw2d: Compute a two-dimensional FFT on a matrix using FFTW3

Description Usage Arguments Author(s) Examples

View source: R/fftwtools.R

Description

Computes two-dimensional FFT on a matrix using the FFTW3 libraries. Use fftw_r2c_2d(x, HermConj=0) for real to complex FFT. This will return the result without the "Hermitian" redundancy. These functions follow the R convention when returning the inverse of the FFT. For the two-dimension fft, the inverse is currently requires the entire matrix, including the redundant complex conjugate.

The function fftw_c2c_xd can calculate a higher dimensional FFT on a higher dimensional array.

Usage

1
2
3
4
fftw2d(data, inverse=0, HermConj=1)
fftw_r2c_2d(data, HermConj=1)
fftw_c2c_2d(data, inverse=0)
fftw_c2c_xd(data, inverse=0)

Arguments

data

(complex or real) matrix to be processed (or array for fftw_c2c_xd)

inverse

(integer) 1 or 0 indicating if inverse FFT is preformed. The return follows the format of the R FFT commands–the output is not scaled.

HermConj

(integer) 1 or 0 indicating if either "Hermitian" redundant conjugate should be returned.

Author(s)

Karim Rahim and Ege Rubak

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x=c(1, 2, 3, 9, 8, 5, 1, 2, 9, 8, 7, 2)
x= t(matrix(x, nrow=4))
mvfft(x)
t(mvfft(t(mvfft(x))))
fftw2d(x)
fftw2d(x, HermConj=0)

fftw2d(fftw2d(x), inverse=1)/12
fftw2d(fftw2d(t(x)), inverse=1)/12
fftw_r2c_2d(x)
fftw_r2c_2d(x, HermConj=0)

fftw_c2c_xd(x)

krahim/fftwtools documentation built on Feb. 28, 2021, 5:30 a.m.