home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************
-
- COPYRIGHT (C) 1992 UNIVERSITY OF CALIFORNIA
-
- ***************************************************************/
-
- us_conv_lp_rbc(x1, x2, h, npt, m)
- int npt, m;
- float *x1, *h;
- register float *x2;
- {
- int nptr, nptl, flag, nptl2, nptr2;
- register int m2, m21;
- float *max1, *max2, *max3, *hmax2, *h1, *x1p1, *x1m1;
- register float *xptr, *hmax1, *hptr, *ptr1, *ptr2;
-
- nptl = m2 = m/2;
- nptr = m - nptl;
- nptl2 = nptl/2;
- nptr2 = nptr/2;
- m21 = m2 - 1;
- h1 = h + 1;
- hmax2 = h + m2;
- x1p1 = x1 + 1;
- x1m1 = x1 - 1;
-
- flag = ( m2 % 2 ) ? 1 : 0;
- max1 = x2 + nptl - 1;
- max2 = x2 + 2*npt - nptr - 1;
- max3 = ( flag ) ? x2 + 2*npt - 1 : x2 + 2*npt;
-
- /*________________________________________________________________*/
-
- /* Type 2 reflection */
-
- ptr1 = x1 + nptl2;
- ptr2 = ( flag ) ? x1m1 + nptr2 : x1 + nptr2;
- if(!flag) {
- nptl2--;
- nptr2++;
- }
- hptr = ( flag ) ? h1 : h;
- hmax1 = h + nptl--;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1-- + *ptr2--);
- hptr += 2;
- }
- *x2++ += *hptr * *ptr2;
-
-
- if(flag) {
- ptr1 = x1 + nptl2--;
- ptr2 = x1 + nptr2++;
- hptr = h;
- hmax1 = h1 + nptl--;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1-- + *ptr2--);
- hptr += 2;
- }
- ptr1 = x1p1;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( !flag )
- *x2++ += *hptr * *ptr2;
- else
- x2++;
- }
-
-
- while(x2 < max1) {
- ptr1 = x1 + nptl2;
- ptr2 = x1m1 + nptr2;
- hptr = h1;
- hmax1 = (hptr = h1) + nptl--;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1-- + *ptr2--);
- hptr += 2;
- }
-
- ptr1 = x1p1;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( flag )
- *x2++ += *hptr * *ptr2;
- else
- x2++;
-
-
- ptr1 = x1 + nptl2--;
- ptr2 = x1 + nptr2++;
- hptr = h;
- hmax1 = h1 + nptl--;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1-- + *ptr2--);
- hptr += 2;
- }
- ptr1 = x1p1;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( !flag )
- *x2++ += *hptr * *ptr2;
- else
- x2++;
- }
-
- /*________________________________________________________________*/
-
- xptr = x1;
- while(x2 < max2) {
- ptr2 = (ptr1 = xptr) + m21;
- hptr = h1;
- hmax1 = hptr + m21;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( flag )
- *x2++ += *hptr * *ptr1;
- else
- x2++;
-
- ptr2 = (ptr1 = xptr) + m2;
- hmax1 = (hptr = h) + m2;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( !flag )
- *x2++ += *hptr * *ptr1;
- else
- x2++;
- xptr++;
- }
- ptr2 = (ptr1 = xptr) + m21;
- hmax1 = (hptr = h1) + m21;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( flag )
- *x2++ += *hptr * *ptr1;
- else
- x2++;
-
- /*________________________________________________________________*/
-
- /* Type 1 reflection */
-
- nptr2 = (nptr = 1) / 2;
- nptl2 = (m - nptr) /2;
- while(x2 < max3) {
- hmax1 = (hptr = h) + nptr++;
- ptr1 = x1 + npt - nptl2--;
- ptr2 = x1 + npt - ++nptr2;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2++);
- hptr += 2;
- }
-
- ptr2 = x1m1 + npt;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( !flag )
- *x2++ += *hptr * *ptr2;
- else
- x2++;
-
-
- hptr = h1;
- hmax1 = h + nptr++;
- ptr1 = x1 + npt - nptl2;
- ptr2 = x1 + npt - nptr2;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2++);
- hptr += 2;
- }
- ptr2 = x1m1 + npt;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
-
- if( flag )
- *x2++ += *hptr * *ptr2;
- else
- x2++;
- }
-
-
- if( flag ) {
- hmax1 = (hptr = h) + nptr;
- ptr1 = x1 + npt - nptl2--;
- ptr2 = x1 + npt - ++nptr2;
- *x2 = 0.;
- while(hptr < hmax1) {
- *x2 += *hptr * (*ptr1++ + *ptr2++);
- hptr += 2;
- }
-
- ptr2 = x1;
- while(hptr < hmax2) {
- *x2 += *hptr * (*ptr1++ + *ptr2--);
- hptr += 2;
- }
- if( !flag )
- *x2 += *hptr * *ptr2;
- }
- }
-
-