fft

std.seq.fft · Level L4

The discrete Fourier transform of a complex vector, unnormalized: yₖ = Σⱼ zⱼ·e^(−2πi·jk/n).

yₖ = Σⱼ zⱼ·e^(−2πi·jk/n)

Signature

fft(z: f64[2, n]) → f64[2, n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

zf64[2, n]FFTyyf64[2, n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference np.fft.fft(z[0] + 1j*z[1]) to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 290 float64 results inside the running error bound; the closest uses 3% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
76%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
19

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Note

A complex vector is a [2, n] array: real parts in the first row, imaginary parts in the second. The reference computes the transform exactly by a radix-2 recursion where n is even; the exact check sums the definition directly, so two different routes have to agree.

Identity

Calls
—
Called by
—
sha256:a5b76b8c01d489d23bbf381571056a51bb724562324d134b75b4f87a47545534

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.