# mvfftw: Compute the FFT on each column of a matrix using FFTW3 In fftwtools: Wrapper for 'FFTW3' Includes: One-Dimensional, Two-Dimensional, Three-Dimensional, and Multivariate Transforms

## Description

This will compute the FFT of each column of a matrix using the FFTW3 libraries. Use mvfftw_r2c(x, HermConj=0) for real to complex fft. This will return the result without the redundant complex conjugate. This follows the R convention for returning the unscaled inverse of the FFT. The function mvfftw_c2r(res, HermConj=0, n=dim(x)[1]) will invert the FFT from the result not containing the "Hermitian" redundant conjugate. You must specify, n, the column dimension of the original data–the column length of the original data–if the redundant complex conjugate is not included.

## Usage

 ```1 2 3 4 5``` ```mvfftw(data, inverse=0, HermConj=1, n=NULL, fftplanopt=0) mvfftw(data, inverse=0, HermConj=1, n=NULL, fftplanopt=0) mvfftw_r2c(data, HermConj=1, fftplanopt=0) mvfftw_c2c(data, inverse=0, fftplanopt=0) mvfftw_c2r(data, HermConj=1, n=NULL, fftplanopt=0) ```

## Arguments

 `data` (complex or real) matrix of columns to be processed `inverse` (integer) 1 or 0 indicating if inverse fft is preformed. The return follows the format of the R FFT commands. The result is not scaled. `HermConj` (integer) 1 or 0 indicating if either "Hermitian" redundant conjugate should be returned, or that the complex to real data includes the "Hermitian" redundant conjugate. `n` (integer) column length of the original data set, when using the inverse coplex to real fft without providing the "Hermitian" redundant conjugate. `fftplanopt` (integer) 0 or 1 specifying the flag passed to FFTW. 0 indicates the flag FFTW_ESTIMATE is used, and 1 indicates FFTW_MEASURE is used. See FFTW documentation for use of these flags.

Karim Rahim

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35``` ```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)))) res <- mvfftw_r2c(x, HermConj=1) res mvfftw_c2c(res, inverse=1)/3 mvfftw_c2r(res)/3 res <- mvfftw_r2c(x, HermConj=0) res mvfftw_c2r(res, HermConj=0, n=3)/3 mvfftw_r2c(x, HermConj=1) mvfft(x) res <- mvfftw_r2c(x, HermConj=0) res mvfftw_c2r(res, HermConj=0, n=3)/3 res <- mvfftw_r2c(t(x), HermConj=1) res mvfftw_c2r(res, HermConj=1)/4 res <- mvfftw_r2c(t(x), HermConj=0) res mvfftw_c2r(res, HermConj=0, n=4)/4 mvfftw_r2c(t(x), HermConj=1) mvfft(t(x)) mvfftw(mvfftw(x, HermConj=0), inverse=1, HermConj=0, n=3)/3 mvfftw(mvfftw(t(x), HermConj=0), inverse=1, HermConj=0, n=4)/4 mvfftw(mvfftw(t(x), inverse=1))/4 ```

### Example output

```               [,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[3,] -7.5-0.866025i -4.5-2.598076i -1-5.196152i  7+0i
[,1]                 [,2]        [,3]                 [,4]
[1,] 57+0.000000i  7.000000- 2.000000i   1+0.0000i  7.000000+ 2.000000i
[2,] -6+8.660254i -3.901924+ 7.169873i -11+3.4641i -9.098076-15.830127i
[3,] -6-8.660254i -9.098076+15.830127i -11-3.4641i -3.901924- 7.169873i
[,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[3,] -7.5-0.866025i -4.5-2.598076i -1-5.196152i  7+0i
[,1] [,2] [,3] [,4]
[1,] 1+0i 2+0i 3+0i 9+0i
[2,] 8+0i 5+0i 1+0i 2+0i
[3,] 9+0i 8+0i 7+0i 2+0i
[,1] [,2] [,3] [,4]
[1,]    1    2    3    9
[2,]    8    5    1    2
[3,]    9    8    7    2
[,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[,1] [,2] [,3] [,4]
[1,]    1    2    3    9
[2,]    8    5    1    2
[3,]    9    8    7    2
[,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[3,] -7.5-0.866025i -4.5-2.598076i -1-5.196152i  7+0i
[,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[3,] -7.5-0.866025i -4.5-2.598076i -1-5.196152i  7+0i
[,1]           [,2]         [,3]  [,4]
[1,] 18.0+0.000000i 15.0+0.000000i 11+0.000000i 13+0i
[2,] -7.5+0.866025i -4.5+2.598076i -1+5.196152i  7+0i
[,1] [,2] [,3] [,4]
[1,]    1    2    3    9
[2,]    8    5    1    2
[3,]    9    8    7    2
[,1]  [,2]  [,3]
[1,] 15+0i 16+0i 26+0i
[2,] -2+7i  7-3i  2-6i
[3,] -7+0i  2+0i  6+0i
[4,] -2-7i  7+3i  2+6i
[,1] [,2] [,3]
[1,]    1    8    9
[2,]    2    5    8
[3,]    3    1    7
[4,]    9    2    2
[,1]  [,2]  [,3]
[1,] 15+0i 16+0i 26+0i
[2,] -2+7i  7-3i  2-6i
[3,] -7+0i  2+0i  6+0i
[,1] [,2] [,3]
[1,]    1    8    9
[2,]    2    5    8
[3,]    3    1    7
[4,]    9    2    2
[,1]  [,2]  [,3]
[1,] 15+0i 16+0i 26+0i
[2,] -2+7i  7-3i  2-6i
[3,] -7+0i  2+0i  6+0i
[4,] -2-7i  7+3i  2+6i
[,1]  [,2]  [,3]
[1,] 15+0i 16+0i 26+0i
[2,] -2+7i  7-3i  2-6i
[3,] -7+0i  2+0i  6+0i
[4,] -2-7i  7+3i  2+6i
[,1] [,2] [,3] [,4]
[1,]    1    2    3    9
[2,]    8    5    1    2
[3,]    9    8    7    2
[,1] [,2] [,3]
[1,]    1    8    9
[2,]    2    5    8
[3,]    3    1    7
[4,]    9    2    2
[,1] [,2] [,3]
[1,] 1+0i 8+0i 9+0i
[2,] 2+0i 5+0i 8+0i
[3,] 3+0i 1+0i 7+0i
[4,] 9+0i 2+0i 2+0i
```

fftwtools documentation built on March 1, 2021, 5:07 p.m.