function y=walsh(x,options)
% Computes the Walsh Hadamard transform.
%
% x       input vector, length has to be a power of two
%
% options 'matrix'       sets up the full matrix W
%         'recursive'    splits into two problems of the half size
%         'sparseProd'   uses the sparse factorisation
%
% Course in Wavelets, TU Chemnitz, 2012

k=log(length(x))/log(2);
if(k~=round(k))
  disp('Error: length of input vector has to be a power of two');
  y=zeros(size(x));
  return;
else
  k=round(k);
end;
  

W1=1/sqrt(2) * [1,1;1,-1];

switch(options)
  case 'matrix'
   ...
  case 'recursive'
   ...
  case 'sparseProd'
   ...
  otherwise
    disp('Error: unknown option');
    y=zeros(size(x));
end;
