PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sum_convcorr_complex (c06pk)
Purpose
nag_sum_convcorr_complex (c06pk) calculates the circular convolution or correlation of two complex vectors of period .
Syntax
Description
nag_sum_convcorr_complex (c06pk) computes:
- if , the discrete convolution of and , defined by
- if , the discrete correlation of and defined by
Here and are complex vectors, assumed to be periodic, with period , i.e., ; and are then also periodic with period .
Note: this usage of the terms ‘convolution’ and ‘correlation’ is taken from
Brigham (1974). The term ‘convolution’ is sometimes used to denote both these computations.
If
,
,
and
are the discrete Fourier transforms of these sequences, and
is the inverse discrete Fourier transform of the sequence
, i.e.,
and
then
and
(the bar denoting complex conjugate).
References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
The computation to be performed:
- (convolution);
- (correlation).
Constraint:
or .
- 2:
– complex array
-
The elements of one period of the vector
. If
x is declared with bounds
in the function from which
nag_sum_convcorr_complex (c06pk) is called, then
must contain
, for
.
- 3:
– complex array
-
The elements of one period of the vector
. If
y is declared with bounds
in the function from which
nag_sum_convcorr_complex (c06pk) is called, then
must contain
, for
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
y. (An error is raised if these dimensions are not equal.)
, the number of values in one period of the vectors
x and
y. The total number of prime factors of
n, counting repetitions, must not exceed
.
Constraint:
.
Output Parameters
- 1:
– complex array
-
The corresponding elements of the discrete convolution or correlation.
- 2:
– complex array
-
The discrete Fourier transform of the convolution or correlation returned in the array
x.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
-
-
-
-
An unexpected error has occurred in an internal call. Check all function calls and array dimensions. Seek expert help.
-
-
On entry, | n has more than prime factors. |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The results should be accurate to within a small multiple of the
machine precision.
Further Comments
The time taken is approximately proportional to , but also depends on the factorization of . nag_sum_convcorr_complex (c06pk) is faster if the only prime factors of are , or ; and fastest of all if is a power of .
Example
This example reads in the elements of one period of two complex vectors and , and prints their discrete convolution and correlation (as computed by nag_sum_convcorr_complex (c06pk)). In realistic computations the number of data values would be much larger.
Open in the MATLAB editor:
c06pk_example
function c06pk_example
fprintf('c06pk example results\n\n');
a = 1 - 0.5i;
b = - 0.5i;
x(1:5) = a;
x(6:9) = b;
y(1:4) = a/2;
y(5:9) = b/2;
job = int64(1);
[conv, tconv, ifail] = c06pk(job, x, y);
job = int64(2);
[corr, tcorr, ifail] = c06pk(job, x, y);
result = [transpose(conv) transpose(corr)];
disp(' Convolution Correlation');
disp(result);
c06pk example results
Convolution Correlation
-0.6250 - 2.2500i 3.1250 - 0.2500i
-0.1250 - 2.2500i 2.6250 - 0.2500i
0.3750 - 2.2500i 2.1250 - 0.2500i
0.8750 - 2.2500i 1.6250 - 0.2500i
0.8750 - 2.2500i 1.1250 - 0.2500i
0.3750 - 2.2500i 1.6250 - 0.2500i
-0.1250 - 2.2500i 2.1250 - 0.2500i
-0.6250 - 2.2500i 2.6250 - 0.2500i
-1.1250 - 2.2500i 3.1250 - 0.2500i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015