%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab script to compute the reference result for the FFT example.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

close all;
clear all;
clc;

wNk = inline('exp(-j * 2 * pi * k / N)', 'N', 'k');

%coefficients produced by c's random number generator in producer_fire()
x = [ -9 + j *  4
      -2 + j *  0
      -3 + j *  0
       8 + j *  3
       6 + j *  0
      -7 + j * -9
      -5 + j *  2
       1 + j *  2
       8 + j * -4
      -6 + j * -4
       9 + j * -2
      -8 + j * -4
      -3 + j *  1
      -9 + j *  7
      -9 + j * -9
      -7 + j *  7
       4 + j * -6
       5 + j * -5
       4 + j *  8
       7 + j * -6
      -3 + j *  9
      -6 + j * -2
      -8 + j * -9
       2 + j *  7
      -5 + j * -7
       7 + j * -9
       0 + j *  9
       5 + j *  1
      -8 + j *  1
       5 + j *  6
      -2 + j * -8
       6 + j * -8
      -5 + j *  7
       5 + j * -9
       8 + j * -5
      -6 + j *  9
       2 + j * -3
       3 + j * -6
       5 + j *  0
      -7 + j *  6
       3 + j * -4
      -2 + j *  4
      -4 + j * -2
       9 + j * -8
      -3 + j *  3
       0 + j * -6
       6 + j *  4
      -2 + j * -4
       9 + j *  0
      -8 + j * -9
       0 + j * -4
       7 + j * -4
       8 + j *  6
      -2 + j * -1
      -8 + j *  6
       9 + j * -3
       1 + j *  4
       3 + j * -3
       2 + j * -2
       9 + j *  6
      -8 + j * -7
      -7 + j *  2
       8 + j * -1
       1 + j *  0
      -1 + j * -3
       3 + j * -9
       1 + j *  9
      -2 + j *  8
       8 + j * -5
       6 + j *  4
       8 + j *  3
       9 + j *  9
       3 + j * -9
       4 + j * -5
       4 + j * -2
       8 + j *  2
      -3 + j *  1
      -8 + j * -9
       4 + j *  6
       4 + j *  7
       2 + j *  7
      -4 + j * -6
       6 + j *  9
       3 + j * -5
       6 + j * -7
      -4 + j * -6
       3 + j * -1
       5 + j *  8
       6 + j * -6
      -5 + j *  0
       2 + j * -2
      -2 + j * -5
      -4 + j * -8
       9 + j * -5
       3 + j *  3
      -3 + j * -9
      -5 + j * -7
       6 + j * -6
      -9 + j * -3
       1 + j * -9
       3 + j * -5
       3 + j *  9
       8 + j * -9
      -8 + j *  3
       1 + j * -5
       9 + j *  4
      -6 + j *  7
       3 + j *  5
       9 + j *  9
      -4 + j * -6
      -1 + j * -8
      -6 + j *  3
       4 + j * -3
      -6 + j * -7
       2 + j * -3
      -8 + j *  0
       1 + j *  9
       9 + j *  0
      -3 + j *  2
      -2 + j *  7
       8 + j * -9
       1 + j *  6
      -4 + j * -1
       5 + j * -1
       8 + j *  9
       3 + j * -9
       8 + j *  3
      -3 + j * -2 ];

fft(x(1:8))
fft(x(1:16))
fft(x(1:64))
fft(x)
