function y = fft17(x,u,ip,op)
% y = fft17(x,u,ip,op)
% y  : the 17 point DFT of x 
% u  : a vector of precomputed multiplicative constants
% ip : input permutation
% op : ouput permutation

y = zeros(17,1);
x = x(ip);                                        % input permutation
x(2:17) = KRED([2],[4],1,x(2:17));                % reduction operations
y(1) = x(1)+x(2);                                 % DC term calculation
% -------------------- block : 1 -------------------------------------------------
y(2) = x(2)*u(1);                       
% -------------------- block : 2 -------------------------------------------------
y(3) = x(3)*u(2);                       
% -------------------- block : 4 -------------------------------------------------
v = ID2I(1,1,x(4:5));              % v = (I(1) kron D2 kron I(1)) * x(4:5)
v = v.*u(3:5);                          
y(4:5) = ID2tI(1,1,v);             % y(4:5) = (I(1) kron D2' kron I(1)) * v
% -------------------- block : 8 -------------------------------------------------
v = ID2I(1,2,x(6:9));              % v = (I(1) kron D2 kron I(2)) * x(6:9)
v = ID2I(3,1,v);                   % v = (I(3) kron D2 kron I(1)) * v
v = v.*u(6:14);                         
v = ID2tI(1,3,v);                  % v = (I(1) kron D2' kron I(3)) * v
y(6:9) = ID2tI(2,1,v);             % y(6:9) = (I(2) kron D2' kron I(1)) * v
% -------------------- block : 16 ------------------------------------------------
v = ID2I(1,4,x(10:17));            % v = (I(1) kron D2 kron I(4)) * x(10:17)
v = ID2I(3,2,v);                   % v = (I(3) kron D2 kron I(2)) * v
v = ID2I(9,1,v);                   % v = (I(9) kron D2 kron I(1)) * v
v = v.*u(15:41);                        
v = ID2tI(1,9,v);                  % v = (I(1) kron D2' kron I(9)) * v
v = ID2tI(2,3,v);                  % v = (I(2) kron D2' kron I(3)) * v
y(10:17) = ID2tI(4,1,v);           % y(10:17) = (I(4) kron D2' kron I(1)) * v
% --------------------------------------------------------------------------------
y(2) = y(1)+y(2);                                 % DC term calculation
y(2:17) = tKRED([2],[4],1,y(2:17));               % transpose reduction operations
y = y(op);                                        % output permutation

% For complex data - 
% Total Number of Real Multiplications : 82
% Total Number of Real Additions: 274

