function x = IFHT(y)
% function x = IFHT(y)
% fast Inverse Haar transform
% y is a column n-vector whose length is a power of two.
% Solves W_{n}x = y where W_{n} is the nxn Haar Transform matrix
n = length(y);
if round(log2(n))~=log2(n)
error('n = length(x) must be a power of two.')
end
if n==1
x = y;
else
yO = y(1:2:n);
yE = y(2:2:n);
x = [IFHT((yO+yE)/2) ; (yO-yE)/2];
end