home *** CD-ROM | disk | FTP | other *** search
/ Los Alamos National Laboratory / LANL_CD.ISO / software / compres / src / conv_ds2.c < prev    next >
C/C++ Source or Header  |  1992-02-11  |  2KB  |  87 lines

  1. /****************************************************************
  2.  
  3. COPYRIGHT (C) 1992 UNIVERSITY OF CALIFORNIA
  4.  
  5. ***************************************************************/
  6.  
  7. conv_ds_lp_rbc(x, x1, h, m, npt)
  8. int m, npt;
  9. float *x, *h;
  10. register float *x1;
  11. {
  12.     int nptl, nptr, flag;
  13.     register int m1, m2;
  14.     float *max1, *max3, *hmax2;
  15.     register float *hptr, *ptr1, *ptr2, *hmax1, *max2, *xptr;
  16.  
  17.     m1 = m - 1;
  18.     nptl = m2 = m/2;
  19.     nptr = m - nptl;
  20.     flag = ( m2 % 2 ) ? 1 : 0;
  21.     hmax2 = h + m2;
  22.  
  23.     max1 = (flag) ? x1 + nptl/2 + 1 : x1 + nptl/2;
  24.     max2 = x1 + (npt - nptr) / 2 + 1;
  25.     max3 = x1 + npt/2;
  26.  
  27. /*________________________________________________________________*/
  28.  
  29.     hmax1 = (hptr = h) + nptl;
  30.     ptr1 = x + nptl;
  31.     ptr2 = x + nptr - 1;
  32.     *x1 = 0.;
  33.     while(hptr < hmax1)
  34.         *x1 += *hptr++ * (*ptr1-- + *ptr2--);
  35.     *x1++ += *hptr * *ptr2;
  36.     nptr += 2;
  37.     nptl -= 2;
  38.  
  39.     while(x1 < max1) {
  40.         hmax1 = (hptr = h) + nptl;
  41.         ptr1 = x + nptl;
  42.         ptr2 = x + nptr - 1;
  43.         nptr += 2;
  44.         nptl -= 2;
  45.         *x1 = 0.;
  46.         while( ptr1 >= x )
  47.             *x1 += *hptr++ * (*ptr1-- + *ptr2--);
  48.         ptr1 = x + 1;
  49.         while(hptr < hmax2)
  50.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  51.         *x1++ += *hptr * *ptr2;
  52.     }
  53.  
  54. /*________________________________________________________________*/
  55.  
  56.     xptr = ( flag ) ? x + 1 : x;
  57.     while(x1 < max2) {
  58.         ptr2 = (ptr1 = xptr) + m1;
  59.         hmax1 = (hptr = h) + m2;
  60.         *x1 = 0.;
  61.         while(hptr < hmax1)
  62.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  63.         *x1++ += *hptr * *ptr1;
  64.         xptr += 2;
  65.     }
  66.  
  67. /*________________________________________________________________*/
  68.  
  69.     nptr = ( flag ) ? 2 : 1;
  70.     nptl = m - nptr;
  71.     while(x1 < max3) {
  72.         hptr = h;
  73.         hmax1 = h + nptr + 1;
  74.         ptr1 = x + npt - nptl;
  75.         ptr2 = x + npt - nptr - 1;
  76.         nptr += 2;
  77.         nptl -= 2;
  78.         *x1 = 0;
  79.         while(hptr < hmax1)
  80.             *x1 += *hptr++ * (*ptr1++ + *ptr2++);
  81.         ptr2 = x + npt - 2;
  82.         while(hptr < hmax2)
  83.             *x1 += *hptr++ * (*ptr1++ + *ptr2--);
  84.         *x1++ += *hptr * *ptr2;
  85.     }
  86. }
  87.