Learn R Programming

spatstat (version 1.53-2)

fourierbasis: Fourier Basis Functions

Description

Evaluates the Fourier basis functions on a \(d\)-dimensional box with \(d\)-dimensional frequencies \(k_i\) at the \(d\)-dimensional coordinates \(x_j\).

Usage

fourierbasis(x, k, win = boxx(rep(list(0:1), ncol(k))))

Arguments

x

Coordinates. A data.frame or matrix with \(m\) rows and \(d\) columns giving the \(d\)-dimensional coordinates.

k

Frequencies. A data.frame or matrix with \(n\) rows and \(d\) columns giving the frequencies of the Fourier-functions.

win

window (of class "owin", "box3" or "boxx") giving the \(d\)-dimensional box domain of the Fourier functions.

Value

An n by m matrix of complex values.

Details

The result is an \(n\) by \(m\) matrix where the \((i,j)\)'th entry is the \(d\)-dimensional Fourier basis function with frequency \(k_i\) evaluated at the point \(x_j\), i.e., $$ \frac{1}{|W|} \exp(2\pi i <k_i,x_j>/|W|) $$ where \(<\cdot,\cdot>\) is the \(d\)-dimensional inner product and \(|W|\) is the volume of the domain (window/box). Note that the algorithm does not check whether the coordinates given in x are contained in the given box. Actually the box is only used to determine the volume of the domain for normalization.

Examples

Run this code
# NOT RUN {
## 27 rows of three dimensional Fourier frequencies:
k <- expand.grid(-1:1,-1:1, -1:1)
## Two random points in the three dimensional unit box:
x <- rbind(runif(3),runif(3))
## 27 by 2 resulting matrix:
v <- fourierbasis(x, k)
head(v)
# }

Run the code above in your browser using DataLab