Skip to content

komm.cyclic_autocorrelation

Computes the cyclic autocorrelation $\tilde{R}[\ell]$ of a real or complex sequence $x[n]$. This is defined as $$ \tilde{R}[\ell] = \sum_{n \in [0:L)} x[n] \tilde{x}^*_\ell[n], $$ where $\tilde{x}^*_\ell[n]$ is the complex conjugate of $x[n]$ cyclic-shifted by $\ell$ positions, and $L$ is the period of the sequence. The cyclic autocorrelation $\tilde{R}[\ell]$ is even symmetric and periodic with period $L$.

Parameters:

  • seq (ArrayLike)

    A 1D-array containing the sequence $x[n]$, of length $L$.

  • shifts (ArrayLike | None)

    A 1D-array containing the values of $\ell$ for which the cyclic autocorrelation will be computed. The default value is range(len(seq)), that is, $[0 : L)$.

  • normalized (bool)

    If True, returns the cyclic autocorrelation divided by the sequence energy, so that $R[0] = 1$. The default value is False.

Returns:

  • NDArray[DType]

    The cyclic autocorrelation $\tilde{R}[\ell]$ of the sequence.

Examples:

>>> komm.cyclic_autocorrelation([1.0, 2.0, 3.0, 4.0], shifts=[-2, -1, 0, 1, 2])
array([22., 24., 30., 24., 22.])