Adapted Wavelet Analysis from Theory to Software

We will restrict our attention to convolution of sequences. We distinguish two cases: aperiodic convolution-decimation of two finitely supported infinite sequences, and periodic convolution-decimation of two periodic sequence.
It is simplest, safest, and most flexible to write a generic convolution-decimation function which can be reused in various transformations. This function will be last on the execution stack and first off, again and again, because it performs the most basic arithmetic and because the transforms we are considering are recursive. Hence we can gain much speed and reliability by a careful design at this step.
It is good programming practice to confine memory manipulation tasks to the least-called functions. It is also good practice to avoid restrictive assumptions about which input values are read before an output value is written. Thus, we will always assume that the input and output are distinct arrays (or streams) and have been preallocated. We will also assume that any necessary scratch arrays are distinct and have been preallocated.
Since convolution-decimation is a linear operation, it is most general to superpose the computed values onto the output array. But this requires that we initialize the output array, either with zeroes or with some previously computed signal. We will also assume that the scratch array contains all zeroes, as well.
If the convolution-decimation is part of a separable multidimensional discrete wavelet transform (see Chapter 9), we may wish to write the output array coefficients noncontiguously in order to eliminate...