correlate

Contents

correlate#

class saiunit.math.correlate(a, v, mode='valid', *, precision=None, preferred_element_type=None, unit_to_scale=None, **kwargs)#

Cross-correlation of two 1-dimensional sequences.

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 (Union[Array, ndarray, number, bool, saiunit.Quantity]) – Input sequences.

  • v (Union[Array, ndarray, number, bool, saiunit.Quantity]) – Input sequences.

  • mode (str) – Refer to the convolve docstring. Note that the default is ‘valid’, unlike convolve, which uses ‘full’.

  • precision (Any) – the backend, a Precision enum value (Precision.DEFAULT, Precision.HIGH or Precision.HIGHEST), a string (e.g. ‘highest’ or ‘fastest’, see the jax.default_matmul_precision context manager), or a tuple of two Precision enums or strings indicating precision of lhs and rhs.

  • preferred_element_type (Union[str, type[Any], dtype, SupportsDType, None]) – accumulation type for the input types, or a datatype, indicating to accumulate results to and return a result with that datatype.

  • unit_to_scale (Optional[saiunit.Unit]) – The unit to scale the x.

Returns:

out – Discrete cross-correlation of a and v.

Return type:

Array