haar_transform


haar_transform, a Python code which computes the Haar transform of data.

In the simplest case, the length of the data vector X is a power of 2. We now consider consecutive pairs of entries of X, and for I from 0 to (N/2)-1, we define:

        S[I] = ( X[2*I] + X[2*I+1] ) / sqrt ( 2 )
        D[I] = ( X[2*I] - X[2*I+1] ) / sqrt ( 2 )
      
We now replace X by the vector S concatenated with D. Assuming that (N/2) is greater than 1, we repeat the operation on the (N/2) entries of S, and so on, until we have reached a stage where our resultant S and D each contain one entry.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

haar_transform is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

cosine_transform, a Python code which demonstrates some simple properties of the discrete cosine transform (DCT).

sftpack, a Python code which implements the "slow" Fourier transform, intended as a teaching tool and comparison with the fast Fourier transform.

sine_transform, a Python code which demonstrates some simple properties of the discrete sine transform.

walsh, a Python code which implements versions of the Walsh and Haar transforms.

Reference:

  1. Ken Beauchamp,
    Walsh functions and their applications,
    Academic Press, 1975,
    ISBN: 0-12-084050-2,
    LC: QA404.5.B33.

Source Code:


Last revised on 08 August 2022.