Types

R is a double precision real (float).
C is a double precision complex.
c is a single precision complex.

Routines

For floats x and y, cmp(x, y) returns the complex number x + iy. See misc.c.

pc(c) prints the complex number c.

m2(c) returns the real square of the magnitude of the complex number c.

rnd() returns one real from a normal distribution with mean 0 and variance 1. Each value is independent of the other values. See rnd.c.

For a single precision array of complex numbers, a, fft(a, n) forms the discrete Fourier transform which displaces the contents of a. The array size n must be a power of 2. If a'[j] is the array content after the call then
a'[j] = Σ[0 ≤ k < 2n] ekji2π 2−na[k]. See more here. See fft.c.

To Build

On a Mac:
gcc -O3 SNR.c misc.c fft.c rnd.c -Wmost