These subroutines compute the convolution and correlation of a sequence
with another sequence, with decimated output, using a direct method.
| h, x, y | Subroutine |
| Short-precision real | SDCON |
| Long-precision real | DDCON |
| Short-precision real | SDCOR |
| Long-precision real | DDCOR |
| Fortran | CALL SDCON | DDCON | SDCOR | DDCOR (h, inch, x, incx, y, incy, nh, nx, iy0, ny, id) |
| C and C++ | sdcon | ddcon | sdcor | ddcor (h, inch, x, incx, y, incy, nh, nx, iy0, ny, id); |
| PL/I | CALL SDCON | DDCON | SDCOR | DDCOR (h, inch, x, incx, y, incy, nh, nx, iy0, ny, id); |
Returned as: an array of (at least) length 1+(Ny-1)|incy|, containing numbers of the data type indicated in Table 142.
The convolution and correlation of a sequence in array H with a sequence in array X, with decimated output, are expressed as follows:
Convolution for SDCON and DDCON:

Correlation for SDCOR and DDCOR:

for k = iy0, iy0+id, iy0+(2)id, ..., iy0+(Ny-1)id
where:
It is assumed that elements outside the range of definition are zero. See reference [4].
SDCON and DDCON can also perform a correlation, autoconvolution, or autocorrelation. To compute a correlation, you must specify a negative stride for H. To compute the autoconvolution, you must specify the two input sequences to be the same. You can also compute the autocorrelation by using both of these techniques together, letting the two input sequences be the same, and specifying a negative stride for the first input sequence. For examples of this, see the examples for SCOND on page "Example 1". Because SCOND and SDCON are functionally the same, their results are the same as long as the decimation interval id = 1 for SDCON.
SDCOR and DDCOR can also perform a convolution, autocorrelation, or autoconvolution. To compute a convolution, you must specify a negative stride for H. To compute the autocorrelation, you must specify the two input sequences to be the same. You can also compute the autoconvolution by using both of these techniques together, letting the two input sequences be the same and specifying a negative stride for the first input sequence. For examples of these, see the examples for SCORD on page "Example 6". Because SCORD and SDCOR are functionally the same, their results are the same as long as the decimation interval id = 1 for SDCOR.
None
This example shows how to compute a convolution of a sequence in H with a sequence in X, where both sequences are ramp functions. It shows how a decimated output can be obtained, using the same input as Example 1 for SCOND and using a decimation interval ID = 2.
H INCH X INCX Y INCY NH NX IY0 NY ID
| | | | | | | | | | |
CALL SDCON( H , 1 , X , 1 , Y , 1 , 4 , 8 , 0 , 6 , 2 )
H = (1.0, 2.0, 3.0, 4.0)
X = (11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
Y = (11.0, 70.0, 130.0, 150.0, 151.0, 72.0)
This example shows how to compute a correlation of a sequence in H with a sequence in X, where both sequences are ramp functions. It shows how a decimated output can be obtained, using the same input as Example 6 for SCORD and using a decimation interval ID = 2.
H INCH X INCX Y INCY NH NX IY0 NY ID
| | | | | | | | | | |
CALL SDCOR( H , 1 , X , 1 , Y , 1 , 4 , 8 , -3 , 6 , 2 )
H = (1.0, 2.0, 3.0, 4.0)
X = (11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
Y = (44.0, 110.0, 140.0, 160.0, 104.0, 18.0)
This example shows how to compute the same function as computed in Example 1 for SCOND. The input sequences and arguments are the same as that example, except a decimation interval ID = 1 is specified here for SDCON.
H INCH X INCX Y INCY NH NX IY0 NY ID
| | | | | | | | | | |
CALL SDCON( H , 1 , X , 1 , Y , 1 , 4 , 8 , 0 , 11 , 1 )
H = (1.0, 2.0, 3.0, 4.0)
X = (11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
Y = (11.0, 34.0, 70.0, 120.0, 130.0, 140.0, 150.0, 160.0,
151.0, 122.0, 72.0)