Wavelet Sub-packages

History

This package was designed with Alain Béliveau and Mohamed Jardak in the winter of 1998 (at the École Polytechnique de Montréal). The idea was to provide a wavelet package that could equally well handle numerical analysis and signal processing. This is made possible by an extensive use of object-oriented design.

Terminology and background

This package assumes you know wavelet theory. If not, a good start is Daubechies' book "Ten lectures on wavelets" published by SIAM.

Numbers of the form k/2^j are called dyadic numbers and form the dyadic grid. If j is the smallest (positive) integer so that x=k/2^j, we say that x is a dyadic number of depth j. The set of all dyadic numbers is a dense set of the reals. A uniformly continuous function over the dyadic numbers is therefore continuous.

In this package, a multiscale function is a function defined (iteratively) on the dyadic grid.

Conventions

  1. Numbering of wavelets

    When wavelets and scaling functions are created, one must keep in mind that the dimension() parameter (often noted n0) is the number of scaling functions (numbered from 0 to n0-1 according the the C-like notation).

    In the dyadic context, with filters of type k (for example), you'll have n0-k wavelets numbered from 0 to n0-k-1. With Haar, for example, which has a filters of type 0, you'll have as many wavelets as you have scaling functions.

  2. DiscreteHilbertSpace and numerical integration

    Numerical integration of irregular functions such as wavelets is a delicate problem. The methods in the class DiscreteHilbertSpace are only some tested solutions. They are not necessarily the best choices and contributions are welcomed (as always)!

To add wavelets (subpackages)

The wavelet package was designed so that one could add wavelets at will. Simply create you own subpackage and obey a few simple rules.

  1. Use numerical integration as included in the DiscreteHilbertSpace class for testing (bi)orthonormality. (You should get the identity matrix).
  2. The lowpass filters must preserve constants away from the boundaries. That is, if you apply the filter to the array {1,1,1,1,1,...,1} then, you'll get {1,1,1,1,1,...,1} (except maybe at the boundaries). This mean that for a dyadic filter, the sum of the coefficients of the filter should be 2 (away from the boundaries).
  3. The euclidean norm of your wavelet filter should be 1 away from the boundary.
  4. Use final static constants whenever possible for performance considerations.
  5. Use the "IllegalScalingException" whenever it applies.
  6. You should have at least one object of type "Multiresolution" if you filters are dyadic.
  7. As a rule, you should handle boundaries properly.

Optimisation and performance

While this package is not designed primarily for speed, it uses fast algorithms and should be adequately fast for most purposes. It was succesfully used for signal processing and numerical analysis and real-time applications have been written from it.

Some notes:

  1. Precision parameter

    Numerous methods have a "precision parameter" or "number of iterations" (same meaning). You should use as small a value as possible for this parameter. Note that it follows a logarithmic scale (everytime you add one, your code slows down by half). A value of 3 or 5 should be sufficient.

  2. Caching results

    The method "evaluate" should be cached whenever possible because it is the costliest method in most cases.

    Exampe : You must replace

    for(int k=0;k<10000;k++) {
            d[k]=f.evaluate(j)[k];
    }
    

    by

    double[] t=f.evaluate(j);
    for(int k=0;k<10000;k++) {
            d[k]=t[k];
    }
    

The future

Image processing is planned in the near future. Wavelets will be added periodically and performance should be gradually enhanced. In particular, the package should include more of in-place computations maybe using the lifting scheme.

Preprocessing and postprocessing is needed for wavelets other than Haar and CDF2_4 when using them in a signal processing context because of boundary effects.

Examples

There is a lot to this package, from wavelet packets to matching pursuit... All the latest ideas are included somehow in this package. But, since one has to start somehow, here are some basic examples.

  1. (Bi)orthonormality

    This code can be used to test the orthonormality of the Daubechies wavelet. Similar code would work for any wavelet.

  2. Signal processing

    This code is an example of signal processing using Daubechies wavelets.

Daniel Lemire (Daniel.Lemire@tintin.net)

Return to the Developer's Guide contents.