These subroutines compute the convolutions and correlations, respectively, of a sequence with one or more sequences using the mixed-radix Fourier method. The input and output sequences contain short-precision real numbers.
Fortran | CALL SCONF | SCORF (init, h, inc1h, x, inc1x, inc2x, y, inc1y, inc2y, nh, nx, m, iy0, ny, aux1, naux1, aux2, naux2) |
C and C++ | sconf | scorf (init, h, inc1h, x, inc1x, inc2x, y, inc1y, inc2y, nh, nx, m, iy0, ny, aux1, naux1, aux2, naux2); |
PL/I | CALL SCONF | SCORF (init, h, inc1h, x, inc1x, inc2x, y, inc1y, inc2y, nh, nx, m, iy0, ny, aux1, naux1, aux2, naux2); |
If init <> 0, trigonometric functions, the transform of the sequence in h, and other parameters, depending on arguments other than x, are computed and saved in aux1. The contents of x and y are not used or changed.
If init = 0, the convolutions or correlations of the sequence that was in h at initialization with the sequences in x are computed. h is not used or changed. The only arguments that may change after initialization are x, y, and aux2. All scalar arguments must be the same as when the subroutine was called for initialization with init <> 0.
Specified as: a fullword integer. It can have any value.
If init <> 0, the working storage is computed.
If init = 0, the working storage is used in the computation of the convolutions.
Specified as: an area of storage, containing naux1 long-precision real numbers.
If naux2 = 0 and error 2015 is unrecoverable, aux2 is ignored.
Otherwise, it is the working storage used by this subroutine, which is available for use by the calling program between calls to this subroutine.
Specified as: an area of storage, containing naux2 long-precision real numbers. On output, the contents are overwritten.
If naux2 = 0 and error 2015 is unrecoverable, SCONF and SCORF dynamically allocate the work area used by the subroutine. The work area is deallocated before control is returned to the calling program.
Otherwise, naux2 >= (minimum value required for successful processing). To determine a sufficient value, use the processor-independent formulas. For all other values specified less than the minimum value, you have the option of having the minimum value returned in this argument. For details, see Using Auxiliary Storage in ESSL.
If init <> 0, this argument is not used, and its contents remain unchanged.
If init = 0, this is array Y, consisting of m output sequences of length Ny that are the result of the convolutions or correlations of the sequence in array H with the sequences in array X.
Returned as: an array of (at least) length 1+(Ny-1)inc1y+(m-1)inc2y, containing short-precision real numbers.
If init <> 0, it contains information ready to be passed in a subsequent invocation of this subroutine.
If init = 0, its contents are unchanged.
Returned as: the contents are not relevant.
Before calculating the necessary sizes of naux1 and naux2, you must determine the length n of the Fourier transform. The value of n is based on nf. You can use one of two techniques to determine nf:
After calculating the value for nf, using one of these two techniques, refer to the formula or table of allowable values of n in Acceptable Lengths for the Transforms, selecting the value equal to or greater than nf.
The required values of naux1 and naux2 depend on the value determined for n in Formulas for the Length of the Fourier Transform.
The convolutions and correlations of a sequence in array H with one or more sequences in array X are expressed as follows.
Convolutions for SCONF:
Correlations for SCORF:
for:
where:
These subroutines use a Fourier transform method with a mixed-radix capability. This provides maximum performance for your application. The length of the transform, n, that you must calculate to determine the correct sizes for naux1 and naux2 is the same length used by the Fourier transform subroutines called by this subroutine. It is assumed that elements outside the range of definition are zero. See references [17] and [84].
Two invocations of this subroutine are necessary:
Error 2015 is unrecoverable, naux2 = 0, and unable to allocate work area.
None
This example shows how to compute a convolution of a sequence in H, where H and X are ramp functions. It calculates all nonzero values of the convolution of the sequences in H and X. The arrays are declared as follows:
REAL*4 H(8), X(10,1), Y(17)
Because this convolution is symmetric in H and X, you can interchange the H and X sequences, leaving all other arguments the same, and you get the same output shown below. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, H , 1 , X , 1 , 1 , Y, 1 , 1 , 8, 10, 1, 0, 17, AUX1, 128, AUX2, 23)
Y = (11.0, 34.0, 70.0, 120.0, 185.0, 266.0, 364.0, 480.0, 516.0, 552.0, 567.0, 560.0, 530.0, 476.0, 397.0, 292.0, 160.0)
This example shows how the output from Example 1 differs when the value for NY is 21 rather than 17, and the value for IY0 is -2 rather than 0. This yields two zeros on each end of the convolution.
Y = (0.0, 0.0, 11.0, 34.0, 70.0, 120.0, 185.0, 266.0, 364.0, 480.0, 516.0, 552.0, 567.0, 560.0, 530.0, 476.0, 397.0, 292.0, 160.0, 0.0, 0.0)
This example shows how to compute the autoconvolution by letting the two input sequences be the same for Example 2. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, H , 1 , H , 1 , 1 , Y, 1 , 1 , 8, 10, 1, -2, 21, AUX1, 128, AUX2, 23)
Y = (1.0, 4.0, 10.0, 20.0, 35.0, 56.0, 84.0, 120.0, 147.0, 164.0, 170.0, 164.0, 145.0, 112.0, 64.0)
This example shows how to compute all nonzero values of the convolution of the sequence in H with the two sequences in X. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, H , 1 , X, 1 , 10 , Y, 1 , 17 , 8, 10, 2, 0, 17, AUX1, 148, AUX2, 43)
X contains the following two sequences:
11.0 12.0 12.0 13.0 13.0 14.0 14.0 15.0 15.0 16.0 16.0 17.0 17.0 18.0 18.0 19.0 19.0 20.0 20.0 11.0
Y contains the following two sequences:
11.0 12.0 34.0 37.0 70.0 76.0 120.0 130.0 185.0 200.0 266.0 287.0 364.0 392.0 480.0 516.0 516.0 552.0 552.0 578.0 567.0 582.0 560.0 563.0 530.0 520.0 476.0 452.0 397.0 358.0 292.0 237.0 160.0 88.0
This example shows how to compute a correlation of a sequence in H, where H and X are ramp functions. It calculates all nonzero values of the correlation of the sequences in H and X. The arrays are declared as follows:
REAL*4 H(8), X(10,1)
First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCORF(INIT, H , 1 , X, 1 , 1 , Y, 1 , 1 , 8, 10, 1, -7, 17, AUX1, 128, AUX2, 23)
Y = (88.0, 173.0, 254.0, 330.0, 400.0, 463.0, 518.0, 564.0, 600.0, 636.0, 504.0, 385.0, 280.0, 190.0, 116.0, 59.0, 20.0)
This example shows how the output from Example 5 differs when the value for NY is 21 rather than 17, and the value for IY0 is -9 rather than 0. This yields two zeros on each end of the correlation.
Y = (0.0, 0.0, 88.0, 173.0, 254.0, 330.0, 400.0, 463.0, 518.0, 564.0, 600.0, 636.0, 504.0, 385.0, 280.0, 190.0, 116.0, 59.0, 20.0, 0.0, 0.0)
This example shows the effect of interchanging H and X. It uses the same input as Example 5, with H and X switched in the calling sequence, and with IY0 with a value of -9. Unlike convolution, as noted in Example 1, the correlation is not symmetric in H and X. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, X , 1 , H, 1 , 1 , Y, 1 , 1 , 8, 10, 1, -9, 17, AUX1, 128, AUX2, 23)
Y = (20.0, 59.0, 116.0, 190.0, 280.0, 385.0, 504.0, 636.0, 600.0, 564.0, 518.0, 463.0, 400.0, 330.0, 254.0, 173.0, 88.0)
This example shows how to compute the autocorrelation by letting the two input sequences be the same. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation. Because there is only one H input sequence, only one autocorrelation can be computed. Furthermore, this usage does not take advantage of the fact that the output is symmetric. Therefore, you should use SACORF to compute autocorrelations, because it does not have either of these problems.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, H , 1 , H, 1 , 1 , Y, 1 , 1 , 8, 8, 1, -7, 15, AUX1, 148, AUX2, 43)
Y = (8.0, 23.0, 44.0, 70.0, 100.0, 133.0, 168.0, 204.0, 168.0, 133.0, 100.0 , 70.0, 44.0, 23.0, 8.0)
This example shows how to compute all nonzero values of the correlation of the sequence in H with the two sequences in X. First, initialize AUX1 using the calling sequence shown below with INIT <> 0. Then use the same calling sequence with INIT = 0 to do the calculation.
INIT H INC1H X INC1X INC2X Y INC1Y INC2Y NH NX M IY0 NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | | | | | CALL SCONF(INIT, H , 1 , X, 1 , 10 , Y, 1 , 17 , 8, 10, 2, -7, 17, AUX1, 148, AUX2, 43)
Y contains the following two sequences:
88.0 96.0 173.0 188.0 254.0 275.0 330.0 356.0 400.0 430.0 463.0 496.0 518.0 553.0 564.0 600.0 600.0 636.0 636.0 592.0 504.0 462.0 385.0 346.0 280.0 245.0 190.0 160.0 116.0 92.0 59.0 42.0 20.0 11.0