% version of haar1d developed in class
function y=haar1d(y)
    m=length(y);
    while(m>1)
        y(1:m)=splithm(y(1:m));
        m=m/2;
    end
end
function z=splithm(z)
    n=length(z)/2;
    e=z(1:2:2*n-1);
    o=z(2:2:2*n);
    z(1:n)=(e+o)/sqrt(2.0);
    z(n+1:2*n)=(e-o)/sqrt(2.0);
end
