The function may be called by the names: c06fkc or nag_sum_convcorr_real.
3Description
c06fkc computes:
if , the discrete convolution of and , defined by
if , the discrete correlation of and defined by
Here and are real 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, i.e.,
then and (the bar denoting complex conjugate).
This function calls the same auxiliary functions as c06pac to compute discrete Fourier transforms.
4References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
5Arguments
1: – Nag_VectorOpInput
On entry: the computation to be performed.
;
.
Constraint:
or .
2: – doubleInput/Output
On entry: the elements of one period of the vector .
must contain , for .
On exit: the corresponding elements of the discrete convolution or correlation.
3: – doubleInput/Output
On entry: the elements of one period of the vector .
must contain , for .
On exit: the discrete Fourier transform of the convolution or correlation returned in the array x; the transform is stored in Hermitian form; if the components of the transform are written as , then for , is contained in , and for , is contained in . (See also Section 2.1.2 in the C06 Chapter Introduction.)
4: – IntegerInput
On entry: , the number of values in one period of the vectors x and y.
Constraint:
.
5: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument had an illegal value.
NE_INT
On entry, .
Constraint: .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
7Accuracy
The results should be accurate to within a small multiple of the machine precision.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
c06fkc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
c06fkc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The time taken is approximately proportional to , but also depends on the factorization of . c06fkc is faster if the only prime factors of are , or ; and fastest of all if is a power of .
10Example
This example reads in the elements of one period of two real vectors and , and prints their discrete convolution and correlation (as computed by c06fkc). In realistic computations the number of data values would be much larger.