Contributed Material

This area of the Numerical Recipes web site is for material contributed by users of the Numerical Recipes books. If you would like to contribute material, contact us through our web contact page. All the material in this area is unsupported. Please read the Terms of Use before you download or use any of the material.

We are grateful to the authors of this material for their willingness to share it with other users, and for their permission to post it on this page.


Daubechies and Cohen-Daubechies-Vial Wavelet Coefficients

Daubechies wavelets (Daubechies, I. 1988, Comm. Pure Appl. Math., vol. 41, pp. 909-996) are discussed extensively in Section 13.10 of Numerical Recipes. They are periodic; wraparound is therefore a nuisance in some applications.

A variant that does not wraparound (lives on the interval) was discovered by Albert Cohen, Ingrid Daubechies, and Pierre Vial. (See "Wavelets on the interval and fast wavelet transforms," Appl. Comput. Harmon. Anal., vol. 1, pp. 54--81, 1993.)

A table of the required coefficients was originally computed by Albert Cohen (see, e.g., here or here); however, the coefficients are given with precision less than normal floating double precision, and are reported to contain errors in the 8th digit or so.

In 1994, Mary Brewster and Gregory Beylkin calculated the coefficients for Daub4, 6, 8, 10, and 12 (both periodic wavelets and wavelets on the interval) to higher precision. These have been available (but difficult to find) at http://amath.colorado.edu/pub/wavelets/software/. With permission from Greg Beylkin, we mirror them here:

  • Daub4
  • Daub6
  • Daub8
  • Daub10
  • Daub12
  • The "interior" coefficients are listed first in each file and apply both to the periodic wavelets and wavelets on the interval. The other coefficients apply only to wavelets on the interval, as described in the Cohen, Daubechies, Vial paper.

    Please note that these files are mirrored, and subject to terms of use that may be different from the Numerical Recipes Terms of Use for contributed materials.


    VecMat View-Based C++ Class Library

    Kevin Dolan (kdolan@mailaps.org) has contributed a set of vector and matrix classes, as well as some supporting tools and math functions, and a set of simple random number generation classes. This software is designed for scientific programming, and as such, the author has tried to build in as much functionality as possible, without sacrificing any more performance than necessary. This is accomplished in part by using a view-based model, to prevent unnecessary copying of data.

    The software is not intended as a linear algebra package. It only supports very basic linear algebra operations like matrix multiplication, dot products, and matrix-vector multiplication, and these routines are highly optimized, but only as much as is possible without using inline assembly language. It is also not intended as a numerical toolkit. On the contrary, it is designed to be compatible with other software that serves those purposes, such as the Numerical Recipes in C++ software, and the FFTW fast Fourier transform C libraries.

  • Package as a zip file
  • On-Line Manual (also contained in the zip file above)
  • Kevin Dolan's Software Page (check here for more current versions)

  • Dynamic Array Allocator Package

    Richard Hogaboom (hogaboom@ll.mit.edu) has contributed a dynamic array allocator package. He writes:

    "I have written a very useful and flexible dynamic array allocator that does allocation based on the pointer to pointer to ... model necessary for passing arrays or subarrays of arrays into subroutines, modifying them there, and seeing the results in the calling routine. Arrays may be up to ten dimensions (although this is only a #define and may be increased), and each subscript may have a different starting value(0, 1, -1, 5, or anything). A single malloc() does all the space allocation for both pointers and data, thus maintaining locality of reference to minimize paging for large arrays. Any type that can be passed to the sizeof() operator may be allocated. There are actually three routines:

    das() - calculates the size of the dynamic array
    daa() - for applications that first allocate memory of size returned by das()
    daam() - for applications that use daam() to allocate memory for them

    Refer to the Embedded Systems Programming web page, www.embedded.com, for a Dec. 2000 article "Flexible Dynamic Array Allocation" that has a much more detailed presentation.

    I have used this code successfully on many projects to provide subroutine modifiable arrays and avoid global data.

    The single file daa.c has all the code including an extensive test suite of 16 tests that may be used to verify routine operations. The header file daa.h is also provided. The code has been tested with the Sun and Gnu compilers. See the notes section in daa.c for exact compile line options for running the tests. A simple ksh script, daa.mk, to compile is provided. Just run the generated executable daa to run the tests."

  • Package as a compressed tar (.tar.gz) file
  • [Note that the above material is copyrighted. You should contact the author directly for conditions on use or redistribution.]


    Additional Primitive Polynomials Modulo 2 of Low Degree

    Dr. Peter Jaeckel of Nikko Europe plc (p.jaeckel@nikko.co.uk) has written a short Maple program that extends the Table in Section 7.7 of Numerical Recipes. The output of this program can be used to generate Sobol' sequences of higher dimensions, or different sequences of lower dimension.

    Dr. Jaeckel writes: "As it is generally foreseeable for us what order of magnitude of dimensions we need, I decided to create a table of primitive polynomials from within maple and include this as a static variable in the code. For your interest, I attach the maple code and also its output when called to generate all primitive polynomials up to degree 15 (3666 polynomials). The sub-arrays are each terminated by an entry of -1 which avoids a second table with the number of primitive polynomials for each degree."

    Dr. Jaeckel and Nikko Europe plc have kindly placed this material into the public domain.

  • Maple program
  • Output from the program

  • Interactive Visualization Tool for X-Windows (UNIX), for use with Numerical Recipes

    Contributed by Wolfgang Koehler, GMD-FIRST an der TU Berlin (German National Research Centre for Computer Science) (email: wolf@first.gmd.de)

    From the README file:

    This toolbox is written as an interactive visualization tool for the "Numerical Recipes", for X-windows under Unix (other platforms are in development).

    It is based on my "grafix" X-Windows library, which routines also may be used explicitly.

    However, it declares some structures and interface functions, which makes it simple to use for users without knowledge of C++ (which is the basis for grafix).

    To have an short overview how it works, please have a look at the demo programs "one-demo.C" and "two-demo.C". If you have an intuitive understanding of these two programs you already should be able to write your own applications for one- and two-dimensional visualizations.

  • Complete README file
  • Entire package as a compressed tar (.tar.Z) file
  • Directory of the individual files

  • Program for Converting Many Numerical Recipes in Fortran 90 to the Lahey ELF Fortran 90 Subset

    Contributed by Alan Miller, Honorary Research Fellow, Division of Mathematics and Statistics, CSIRO. (email: Alan.Miller@dms.csiro.au, web: http://members.ozemail.com.au/~milleraj/ )

    ELF90 (Essential Lahey Fortran 90) is a free Fortran 90 compiler for MS-DOS. It only supports a subset of Fortran 90, leaving out much of the old F66 and F77 features. The Numerical Recipes Fortran 90 code is not compatible with the ELF90 subset. This program, which can be compiled with ELF90, does much of the needed conversion so that most subroutines and perhaps half of the functions will run. The comments at the start of the code describe the conversions performed, and some of the problems which remain.

    With this conversion program, and with some changes to the nr module, 192 of the 327 subroutines and functions will compile with the free ELF90 compiler. (Of course, all of the remaining ones can be made to compile by some rewriting of their code.)

  • NR_ELF90.F90 (text file)

  • Package of Matrix and Vector Utility Functions for use with Numerical Recipes

    Contributed by James Trevelyan (jamest@mech.uwa.edu.au), Department of Mechanical and Materials Engineering, The University of Western Australia.

    This package provides utility functions such as matrix multiplication and other arithmetic, reading matrix objects from and writing to text files, etc., to support programs using NR library functions. It also has built-in code to protect array boundaries and dynamic memory pointers, and to report errors, displaying the function where they are detected and where that function was called from. There are some useful functions for 4x4 homogeneous coordinate transformations - rotations, quaternions, etc. The package has been designed for students and researchers using C or C++ on Unix, DOS/Windows or Macintosh computer systems.

  • Manual (text file)
  • Manual (postscript file)
  • Manual (RTF file for Microsoft Word)
  • nrutil.c, the Utilities (C source)
  • nrcheck.c, wrapper functions (C source)
  • Makefile for demo program
  • nrdemo.c demo program (C source)
  • nrframe.c (C source used by demo)
  • nrlinwww.c (C source used by demo)
  • nrlin.h (C source used by demo)
  • input data for demo program

  • Oppenheimer mp3 file

    zipped Oppenheimer mp3 file