correlate#
- class brainunit.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 (
Array|ndarray|bool|number|bool|int|float|complex| saiunit.Quantity) – Input sequences.v (
Array|ndarray|bool|number|bool|int|float|complex| 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, aPrecisionenum value (Precision.DEFAULT,Precision.HIGHorPrecision.HIGHEST), a string (e.g. ‘highest’ or ‘fastest’, see thejax.default_matmul_precisioncontext manager), or a tuple of twoPrecisionenums or strings indicating precision oflhsandrhs.preferred_element_type (
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 (saiunit.Unit |
None) – The unit to scale thex.
- Returns:
out – Discrete cross-correlation of a and v.
- Return type:
Array