Skip to contents

Mirrors the C# Fourier.FFT: an in-place complex FFT on data packed as [re0, im0, re1, im1, ...]; length(x) / 2 must be a power of two.

Usage

dft(x, inverse = FALSE)

Arguments

x

numeric vector, complex data packed as [re0, im0, re1, im1, ...].

inverse

if TRUE, computes n times the inverse transform (matching the C# doc comment – divide by n for the true inverse).

Value

the transformed vector, same length as x.

Examples

dft(c(1, 0, 2, 0, 3, 0, 4, 0))
#> [1] 10  0 -2 -2 -2  0 -2  2