This subroutine computes the autocorrelations of one or more sequences using the mixed-radix Fourier method. The input and output sequences contain short-precision real numbers.
Fortran | CALL SACORF (init, x, inc1x, inc2x, y, inc1y, inc2y, nx, m, ny, aux1, naux1, aux2, naux2) |
C and C++ | sacorf (init, x, inc1x, inc2x, y, inc1y, inc2y, nx, m, ny, aux1, naux1, aux2, naux2); |
PL/I | CALL SACORF (init, x, inc1x, inc2x, y, inc1y, inc2y, nx, m, ny, aux1, naux1, aux2, naux2); |
If init <> 0, trigonometric functions 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 autocorrelations of the sequence in x are computed. 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 autocorrelations.
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, SACORF dynamically allocates the work area used by this 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 autocorrelation functions of 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. To do this, you use the values of the arguments nx and ny, inserted into the following formula, to get a value for the variable nf. After calculating nf, reference the formula or table of allowable values of n in Acceptable Lengths for the Transforms, selecting the value equal to or greater than nf. Following is the formula for determining nf:
The required values of naux1 and naux2 depend on the value determined for n in Formula for Calculating the Length of the Fourier Transform and the argument m.
The autocorrelations of the sequences in array X are expressed as follows:
for:
where:
This subroutine uses 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. 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 an autocorrelation for three short sequences in array X, where the input sequence length NX is equal to the output sequence length NY. This gives all nonzero autocorrelation values. The arrays are declared as follows:
REAL*4 X(0:49999), Y(0:49999) REAL*8 AUX1(30788), AUX2(17105)
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 X INC1X INC2X Y INC1Y INC2Y NX M NY AUX1 NAUX1 AUX2 NAUX2 | | | | | | | | | | | | | | CALL SACORF(INIT, X , 1 , 7 , Y , 1 , 7 , 7 , 3 , 7 , AUX1, 2959, AUX2, 4354)
X contains the following three sequences:
1.0 2.0 3.0 2.0 1.0 2.0 3.0 2.0 1.0 4.0 3.0 2.0 4.0 4.0 3.0 3.0 4.0 4.0 2.0 3.0 4.0
Y contains the following three sequences:
59.0 59.0 59.0 54.0 50.0 44.0 43.0 39.0 30.0 29.0 27.0 24.0 16.0 18.0 21.0 7.0 11.0 20.0 2.0 6.0 12.0
This example shows how the output from Example 1 differs when the value for NY and INC2Y are 9 rather than 7. This shows that when NY is greater than NX, the output array is longer and that part is filled with zeros.
Y contains the following three sequences:
59.0 59.0 59.0 54.0 50.0 44.0 43.0 39.0 30.0 29.0 27.0 24.0 16.0 18.0 21.0 7.0 11.0 20.0 2.0 6.0 12.0 0.0 0.0 0.0 0.0 0.0 0.0
This example shows how the output from Example 1 differs when the value for NY is 5 rather than 7. Also, the values for INC1X and INC1Y are 3 rather than 1, and the values for INC2X and INC2Y are 1 rather than 7. This shows that when NY is less than NX, the output array is shortened.
Y contains the following three sequences:
59.0 59.0 59.0 54.0 50.0 44.0 43.0 39.0 30.0 29.0 27.0 24.0 16.0 18.0 21.0