Create Xref-Html Frames                    Remove All Frames
file:d:/code/LRC/Splicer/splicer_code_ver2.2/gauss_weights.c        (Tue Mar 14 16:28:58 2000 )


   1: /*
   2: function: gauss-weights
   3: */
   4: #include <stdio.h>
   5: 
   6: void gauss_weights(width,weight)
   7: int width;
   8: float *weight;
   9: {
  10:   double  exp (), foldwidth, halfwidth, power, sum = 0.0;
  11:   int ia;
  12: 
  13:   foldwidth = ((double) width - 1.0) / 3.0;
  14:   halfwidth = ((double) width - 1.0) / 2.0;
  15: 
  16:   /*  compute unscaled weights  */
  17:   for (ia = 1;  ia <= width;  ia++)
  18:   {
  19:     power = (halfwidth - (double) ia + 1.0) / foldwidth;
  20:     power = -1.0 * power * power;
  21:     weight[ia] = exp (power);
  22:     sum += weight[ia];
  23: 
  24:     /*  set pointers  */
  25:   }
  26: 
  27:   /*  scale weights to add to 1.0  */
  28:   for (ia = 1;  ia <= width;  ia++)
  29:     weight[ia] /= sum;
  30: 
  31: }  /*  end gauss_weights  */
  32: 








































Html form generated by Xrefactory version 1.6.7 on Fri Sep 03 17:18:59 2004