jax.numpy.correlate

Contents

jax.numpy.correlate#

jax.numpy.correlate(a, v, mode='valid', *, precision=None, preferred_element_type=None)[source]#

Cross-correlation of two 1-dimensional sequences.

LAX-backend implementation of numpy.correlate().

In addition to the original NumPy arguments listed below, also supports precision for extra control over matrix-multiplication precision on supported devices. precision may be set to None, which means default precision for the backend, a Precision enum value (Precision.DEFAULT, Precision.HIGH or Precision.HIGHEST) or a tuple of two Precision enums indicating separate precision for each argument.

Original docstring below.

This function computes the correlation as generally defined in signal processing texts:

\[c_k = \sum_n a_{n+k} \cdot \overline{v}_n\]

with a and v sequences being zero-padded where necessary and \(\overline x\) denoting complex conjugation.

Parameters:
  • a (array_like) – Input sequences.

  • 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’.

  • preferred_element_type (dtype, optional) – If specified, accumulate results and return a result of the given data type. If not specified, the function instead follows the numpy convention of always accumulating results and returning an inexact dtype.

  • precision (PrecisionLike)

Returns:

out – Discrete cross-correlation of a and v.

Return type:

ndarray