real.fft: Fast calculation of the two-dimensional real Fourier...

View source: R/spateFcts.R

real.fftR Documentation

Fast calculation of the two-dimensional real Fourier transform.

Description

Fast calculation of the real Fourier transform. This is a wrapper function for a C function which uses the complex FFT function from the 'fftw3' library.

Usage

real.fft(w,n,inv=TRUE,indFFT=NULL)

Arguments

w

A spatial field in a stacked vector of length N=n^2.

n

Number of grid points on each axis. n x n is the total number of spatial points.

inv

Indicates whether the inverse Fourier transform should be calculated or not.

indFFT

A list of containing vectors of natural numbers representing indices used to transform between the real and the complex Fourier transform.

Value

A vector of length n*n containing the real (inverse) Fourier transformation of 'w'.

Author(s)

Fabio Sigrist

Examples

n <- 100
spec <- matern.spec(wave=spate.init(n=n,T=1)$wave,n=n,rho0=0.05,sigma2=1,norm=TRUE)
sim <- real.fft(sqrt(spec)*rnorm(n*n),n=n,inv=FALSE)
image(1:n,1:n,matrix(sim,nrow=n),main="Sample from Matern field",xlab="",ylab="")

spate documentation built on Oct. 3, 2023, 5:09 p.m.