# Convolve

Advanced Analysis Library Only

AnalysisLibErrType Convolve (double YArray[], int numberYElements, double XArray[], int numberXElements, double HArray[]);

## Purpose

Finds the convolution of the input arrays. Convolve obtains the convolution using the following formula:

where | a = 0, b = i for 0 i < m
| a = i — m + 1, b = i for m i < n
| a = i — m + 1, b = n — 1 for n i n + m — 1

| Note This formula description assumes that m n. For m > n, exchange (x, y) and (m, n) in the previous equations.

| Note This function temporarily allocates memory for use as a work area. If Convolve cannot allocate memory, the function returns an error code.

### Example

/* Generate two arrays with random numbers and find their convolution. */
double x[256], y[256], cxy[512];
int n, m;
n = 256;
m = 256;
Uniform (n, 17, x);
Uniform (m, 17, y);
Convolve (x, n, y, m, cxy);

## Parameters

Input
Name | Type | Description
YArray | double-precision array | First input array.
numberYElements | integer | Number of elements in YArray.
XArray | double-precision array | Second input array.
numberXElements | integer | Number of elements in XArray. numberXElements must be less than or equal to numberYElements.
Output
Name | Type | Description
HArray | double-precision array | Convolution array. The size of this array must be at least (numberYElements — numberXElements + 1) elements long. This algorithm executes more efficiently if the sizes of the input arrays are a power of two.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.