Previous Next Contents Generated Index Doc Set Home



Convolution or Correlation

The subroutines described in this section compute the convolution or correlation of a filter with one or more input vectors.

Calling Sequence

CALL SCNVCOR
(CNVCOR, METHOD, NX, SX, IFX, INCX, NY, NPRE, M, SY, 
IFY, INC1Y, INC2Y, NZ, K, SZ, IFZ, INC1Z, INC2Z, SWORK, 
LWORK)
CALL DCNVCOR
(CNVCOR, METHOD, NX, DX, IFX, INCX, NY, NPRE, M, DY, 
IFY, INC1Y, INC2Y, NZ, K, DZ, IFZ, INC1Z, INC2Z, DWORK, 
LWORK)
CALL CCNVCOR
(CNVCOR, METHOD, NX, CX, IFX, INCX, NY, NPRE, M, CY, 
IFY, INC1Y, INC2Y, NZ, K, CZ, IFZ, INC1Z, INC2Z, CWORK, 
LWORK)
CALL ZCNVCOR
(CNVCOR, METHOD, NX, ZX, IFX, INCX, NY, NPRE, M, ZY, 
IFY, INC1Y, INC2Y, NZ, K, ZZ, IFZ, INC1Z, INC2Z, ZWORK, 
LWORK)






void scnvcor
(char cnvcor, char method, int nx, float *sx, int ifx, 
int incx, int ny, int npre, int m, float *sy, int ify, 
int inc1y, int inc2y, int nz, int k, float *sz, int 
ifz, int inc1z, int inc2z, float *swork, int lwork)
void dcnvcor
(char cnvcor, char method, int nx, double *dx, int ifx, 
int incx, int ny, int npre, int m, double *dy, int ify, 
int inc1y, int inc2y, int nz, int k, double *dz, int 
ifz, int inc1z, int inc2z, double *dwork, int lwork)
void ccnvcor
(char cnvcor, char method, int nx, complex *cx, int 
ifx, int incx, int ny, int npre, int m, complex *cy, 
int ify, int inc1y, int inc2y, int nz, int k, complex 
*cz, int ifz, int inc1z, int inc2z, complex *cwork, int 
lwork)
void zcnvcor
(char cnvcor, char method, int nx, doublecomplex *zx, 
int ifx, int incx, int ny, int npre, int m, 
doublecomplex *zy, int ify, int inc1y, int inc2y, int 
nz, int k, doublecomplex *zz, int ifz, int inc1z, int 
inc2z, doublecomplex *zwork, int lwork)

Arguments

CNVCOR

Indicates whether to perform convolution or correlation. The legal values for CNVCOR are listed below. Any values not listed below are illegal.

`V' or `v' Convolution

`R' or `r' Correlation

METHOD

Indicates which method to use to compute the convolution or correlation. The legal values for METHOD are listed below. Any values not listed below are illegal.

`T' or `t' Fourier transform

`D' or `d' Direct method

NX

On entry, the length of the X vector. NX 0.

xX

On entry, the filter vector xX(*).

IFX

On entry, the first element of xX to use. IFX > 0 for FORTRAN interfaces and IFX 0 for C interfaces.

INCX

On entry, the stride between elements of xX. INCX > 0.

NY

On entry, the length of the Y vector. NY 0.

NPRE

On entry, the number of implicit zeros prepended to each Y vector.

M

On entry, the number of Y vectors. M 0.

xY

On entry, the array of Y vectors Y(LDY,*).

IFY

On entry, the first element of xY to use. IFY > 0 for FORTRAN interfaces and IFY 0 for C interfaces.

INC1Y

On entry, the stride between elements of Y. INC1Y 0.

INC2Y

On entry, the stride between Y vectors. INC2Y 0.

NZ

On entry, the length of output vectors. NZ 0.

K

On entry, the number of output vectors. K 0.

xZ

Undefined on entry. On exit, the output vectors Z(LDZ,*).

IFZ

On entry, the first element of xZ to use. IFZ > 0 for FORTRAN interfaces and IFZ 0 for C interfaces.

INC1Z

On entry, the stride between elements of a Z vector. INC1Z 0.

INC2Z

On entry, the stride between Z vectors. INC2Z 0.

xWORK

On entry, an array with dimension of at least (NX + NY + NZ + 45). For the Fourier method, the first element of the work array should be zero the first time the routines are called. After the first call, as long as the work array has not been altered and the values of NX, NY, and NZ are the same, the same work array can be reused and the routine will be able to run faster. If the work array is changed or is used for different values of NX, NY, or NZ then set the first element of xWORK to zero before calling this routine.

xLWORK

On entry, the length of xWORK.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LWORK
      INTEGER           N
      PARAMETER        (N = 3)
      PARAMETER        (LWORK = 4 * N + 15)
C
      COMPLEX           P1(N), P2(N), P3(2*N-1), WORK(LWORK)
C
      DATA P1 / 1, 2, 3 /,  P2 / 4, 5, 6 /
C
      EXTERNAL          CCNVCOR
C
      PRINT *, `P1:'
      PRINT 1000, P1
      PRINT *, `P2:'
      PRINT 1000, P2
C
      CALL CCNVCOR (`V', `T', N, P1, 1, 1, N, 0, 1, P2, 1, 1, 1,
     $              2 * N - 1, 1, P3, 1, 1, 1, WORK, LWORK)
C
      PRINT *, `P3:'
      PRINT 1000, P3
C
 1000 FORMAT (1X, 100(F4.1' +',F4.1,'i  `))
C
      END



Sample Output




 P1:
  1.0 + 0.0i   2.0 + 0.0i   3.0 + 0.0i  
 P2:
  4.0 + 0.0i   5.0 + 0.0i   6.0 + 0.0i  
 P3:
  4.0 + 0.0i  13.0 + 0.0i  28.0 + 0.0i  27.0 + 0.0i  18.0 + 0.0i  
  




Previous Next Contents Generated Index Doc Set Home