VCONR

   more...
Computes the convolution of two real vectors.
Required Arguments
X — Vector of length NX. (Input)
Y — Vector of length NY. (Input)
Z — Vector of length NZ containing the convolution Z = X * Y. (Output)
Optional Arguments
NX — Length of the vector X. (Input)
Default: NX = SIZE (X,1).
NY — Length of the vector Y. (Input)
Default: NY = SIZE (Y,1).
NZ — Length of the vector Z. (Input)
NZ must be at least NX + NY 1.
Default: NZ = SIZE (Z,1).
FORTRAN 90 Interface
Generic: CALL VCONR (X, Y, Z [])
Specific: The specific interface names are S_VCONR and D_VCONR.
FORTRAN 77 Interface
Single: CALL VCONR (NX, X, NY, Y, NZ, Z)
Double: The double precision name is DVCONR.
Description
The routine VCONR computes the convolution z of two real vectors x and y. Let nx = NX, ny = NY and nz = NZ. The vector z is defined to be
where nz = nx + ny  1. If the index j  k + 1 is outside the range 1, 2, nx, then xj k+ 1 is taken to be zero.
The fast Fourier transform is used to compute the convolution. Define the complex vector u of length nz = nx + ny  1 to be
The complex vector v, also of length nz, is defined similarly using y. Then, by the Fourier convolution theorem,
where the indicates the Fourier transform of u computed via IMSL routines FFTCF and FFTCB (see Chapter 6, “Transforms”) is used to compute the complex vector w from . The vector z is then found by taking the real part of the vector w.
Comments
Workspace may be explicitly provided, if desired, by use of V2ONR/DV2ONR. The reference is
CALL V2ONR (NX, X, NY, Y, NZ, Z, XWK, YWK, ZWK, WK)
The additional arguments are as follows:
XWK — Complex work array of length NX + NY  1.
YWK — Complex work array of length NX + NY  1.
ZWK — Complex work array of length NX + NY  1.
WK — Real work array of length 6 * (NX + NY  1) + 15.
Example
In this example, the convolution of a vector x of length 8 and a vector y of length 3 is computed. The resulting vector z is of length 8 + 3  1 = 10. (The vector y is sometimes called a filter.)
 
USE VCONR_INT
USE WRRRN_INT
 
IMPLICIT NONE
INTEGER NX, NY, NZ
PARAMETER (NX=8, NY=3, NZ=NX+NY-1)
!
REAL X(NX), Y(NY), Z(NZ)
! Set values for X
! X = (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0)
! Set values for Y
! Y = (0.0 0.0 1.0)
!
DATA X/1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0/
DATA Y/0.0, 0.0, 1.0/
! Compute vector convolution
! Z = X * Y
CALL VCONR (X,Y,Z)
! Print results
CALL WRRRN ('Z = X (*) Y', Z, 1, NZ, 1)
END
Output
 
Z = X (*) Y
1 2 3 4 5 6 7 8 9 10
0.000 0.000 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000