# numpy.correlate¶

numpy.correlate(a, v, mode='valid', old_behavior=True)

Discrete, linear correlation of two 1-dimensional sequences.

This function is equivalent to

```>>> np.convolve(a, v[::-1], mode=mode)
```

where v[::-1] is the reverse of v.

Parameters: a, v : array_like Input sequences. mode : {‘valid’, ‘same’, ‘full’}, optional Refer to the convolve docstring. Note that the default is valid, unlike convolve, which uses full. old_behavior : bool If True, uses the old, numeric behavior (correlate(a,v) == correlate(v, a), and the conjugate is not taken for complex arrays). If False, uses the conventional signal processing definition (see note).

convolve
Discrete, linear convolution of two one-dimensional sequences.
acorrelate
Discrete correlation following the usual signal processing definition for complex arrays, and without assuming that correlate(a, b) == correlate(b, a).

Notes

If old_behavior is False, this function computes the correlation as generally defined in signal processing texts:

`z[k] = sum_n a[n] * conj(v[n+k])`

with a and v sequences being zero-padded where necessary and conj being the conjugate.

Examples

```>>> np.correlate([1, 2, 3], [0, 1, 0.5])
array([ 3.5])
>>> np.correlate([1, 2, 3], [0, 1, 0.5], "same")
array([ 2. ,  3.5,  3. ])
>>> np.correlate([1, 2, 3], [0, 1, 0.5], "full")
array([ 0.5,  2. ,  3.5,  3. ,  0. ])
```

numpy.corrcoef

numpy.cov