//void print_filter(struct filter *f) {

        ///* Prints out the filter structure.
//   Input:
//   f = wavelet filter structure
//   Output:
//   none
//*/
//  printf("Wavelet Filter (L = %d):\n", f.L);
//  printf("  h := \n");
//  printdvec(f.H, f.L);
//  printf("  g := \n");
//  printdvec(f.G, f.L);
//}

/*  This function converts the basic Haar wavelet filter
 *  (h0 = -0.7017, h1 = 0.7017) into a filter of length `scale.'
 *  The filter is re-normalized so that it's sum of squares equals 1.
 *
 *  Input:
 *  f     = haar wavelet filter structure
 *  scale = integer
 *
 *  Output:
 *  fills in h, g, and L for a wavelet filter structure
 */
        public void convert_haar(WaveletFilter f, int scale)
        {
            if (f.filterType != WaveletFilterType.Haar)
            {
                throw new InvalidDataException("must be a haar wavelet structure");
            }

            double sqrt_scale = Math.Sqrt(scale);

            this.L = (int)f.L * scale;
            this.H = new double[f.L * scale + 1];
            this.G = new double[f.L * scale + 1];

            for (int l = 1; l <= scale; l++)
            {
                this.H[l]         = f.H[1] / sqrt_scale;
                this.G[l]         = f.G[1] / sqrt_scale;
                this.H[l + scale] = f.H[2] / sqrt_scale;
                this.G[l + scale] = f.G[2] / sqrt_scale;
            }
        }
 public WaveletTransform(WaveletFilter filter)
 {
     this.f = filter;
 }