Purpose
To compute the convolution or deconvolution of two real signals A and B.Specification
SUBROUTINE DE01OD( CONV, N, A, B, INFO ) C .. Scalar Arguments .. CHARACTER CONV INTEGER INFO, N C .. Array Arguments .. DOUBLE PRECISION A(*), B(*)Arguments
Mode Parameters
CONV CHARACTER*1 Indicates whether convolution or deconvolution is to be performed as follows: = 'C': Convolution; = 'D': Deconvolution.Input/Output Parameters
N (input) INTEGER The number of samples. N must be a power of 2. N >= 2. A (input/output) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the first signal. On exit, this array contains the convolution (if CONV = 'C') or deconvolution (if CONV = 'D') of the two signals. B (input) DOUBLE PRECISION array, dimension (N) On entry, this array must contain the second signal. NOTE that this array is overwritten.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
This routine computes the convolution or deconvolution of two real signals A and B using an FFT algorithm (SLICOT Library routine DG01MD).References
[1] Rabiner, L.R. and Rader, C.M. Digital Signal Processing. IEEE Press, 1972.Numerical Aspects
The algorithm requires 0( N*log(N) ) operations.Further Comments
NoneExample
Program Text
* DE01OD EXAMPLE PROGRAM TEXT * Copyright (c) 2002-2017 NICONET e.V. * * .. Parameters .. INTEGER NIN, NOUT PARAMETER ( NIN = 5, NOUT = 6 ) INTEGER NMAX PARAMETER ( NMAX = 128 ) * .. Local Scalars .. INTEGER I, INFO, N CHARACTER*1 CONV * .. Local Arrays .. DOUBLE PRECISION A(NMAX), B(NMAX) * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. External Subroutines .. EXTERNAL DE01OD * .. Executable Statements .. * WRITE ( NOUT, FMT = 99999 ) * Skip the heading in the data file and read the data. READ ( NIN, FMT = '()' ) READ ( NIN, FMT = * ) N, CONV IF ( N.LE.0 .OR. N.GT.NMAX ) THEN WRITE ( NOUT, FMT = 99994 ) N ELSE READ ( NIN, FMT = * ) ( A(I), B(I), I = 1,N ) * Perform convolution on A and B. CALL DE01OD( CONV, N, A, B, INFO ) * IF ( INFO.NE.0 ) THEN WRITE ( NOUT, FMT = 99998 ) INFO ELSE IF ( LSAME( CONV, 'C' ) ) THEN WRITE ( NOUT, FMT = 99997 ) ELSE WRITE ( NOUT, FMT = 99996 ) END IF DO 20 I = 1, N WRITE ( NOUT, FMT = 99995 ) I, A(I) 20 CONTINUE END IF END IF STOP * 99999 FORMAT (' DE01OD EXAMPLE PROGRAM RESULTS',/1X) 99998 FORMAT (' INFO on exit from DE01OD = ',I2) 99997 FORMAT (' Convolution ',//' i A(i)',/) 99996 FORMAT (' Deconvolution ',//' i A(i)',/) 99995 FORMAT (I4,1X,F8.4) 99994 FORMAT (/' N is out of range.',/' N = ',I5) ENDProgram Data
DE01OD EXAMPLE PROGRAM DATA 8 C 0.4862 0.2288 0.1948 0.3671 0.5788 0.6417 -0.5861 0.3875 0.8254 0.2380 0.1815 0.4682 0.2904 0.5312 -0.3599 0.6116Program Results
DE01OD EXAMPLE PROGRAM RESULTS Convolution i A(i) 1 0.5844 2 0.5769 3 0.6106 4 1.0433 5 0.6331 6 0.4531 7 0.7027 8 0.9929