Z — Complex 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: CALLVCONC (X, Y, Z[, …])
Specific: The specific interface names are S_VCONC and D_VCONC.
FORTRAN 77 Interface
Single: CALLVCONC (NX, X, NY, Y, NZ, Z)
Double: The double precision name is DVCONC.
Description
The routine VCONC computes the convolution z of two complex vectors x and y. Let nx = NX, then 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 using IMSL routine FFTCF. The complex vector z is computed from via IMSL routine FFTCB. See Chapter 6, “Transforms” for more information on these functions.
Comments
Workspace may be explicitly provided, if desired, by use of V2ONC/DV2ONC. The reference is
CALL V2ONC (NX, X, NY, Y, NZ, Z, XWK, YWK, 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.
WK — Real work array of length 6 * (NX + NY‑ 1) + 15.
Example
In this example, the convolution of a vector x of length 4 and a vector y of length 3 is computed. The resulting vector z is of length 4 + 3 ‑ 1. (y is sometimes called a filter.)
USE VCONC_INT
USE WRCRN_INT
IMPLICIT NONE
INTEGER NX, NY, NZ
PARAMETER (NX=4, NY=3, NZ=NX+NY-1)
!
COMPLEX X(NX), Y(NY), Z(NZ)
! Set values for X
! X = ( 1.0+2.0i 3.0+4.0i 5.0+6.0i 7.0+8.0i )
! Set values for Y
! Y = (0.0+0i 0.0+0i 1.0+0i )
!
DATA X/(1.0,2.0), (3.0,4.0), (5.0,6.0), (7.0,8.0)/