Real data
Real input has a spectrum with Hermitian symmetry:
using FFTL, Random
Random.seed!(5)
x = randn(1000, 300)
X = rfft(x)
size(X)(501, 300)The first transformed dimension is halved:
Going back
The inverse needs the length of the real array, because an odd and an even length can give the same half spectrum. irfft takes it explicitly:
irfft(X, 1000) ≈ xtruey = randn(999)
Y = rfft(y)
size(Y), irfft(Y, 999) ≈ y((500,), true)brfft is the unnormalised inverse, the real counterpart of bfft. It differs from irfft by the product of the transformed lengths, the number of elements in the region; for one dimension, the length of the real array:
y1 = randn(999)
Y1 = rfft(y1)
brfft(Y1, 999) ≈ 999 .* irfft(Y1, 999)trueWhich dimension is halved
The half spectrum is taken along the first dimension of the region. To halve dimension 2 of a matrix, put it first in the region:
Z = randn(64, 128)
size(rfft(Z, (2, 1)))(33, 128)Plans
plan_rfft, plan_irfft and plan_brfft return plans with the same rules as the complex ones, including inv for the normalised inverse. Use them when the same real size is transformed many times; see Plans and reuse.