The autocorr family of objects implement auto-correlation of signals. The discrete auto-correlation of a signal \(\vec{x}\) is a delay, conjugate multiply, and accumulate operation defined as

$$ r_{xx}(n) = \sum_{k=0}^{N-1} {x(n-k)x^*(n-k-d)} $$

where \(N\) is the window length, and \(d\) is the overlap delay. An example of the autocorr interface is listed below.

#include <liquid/liquid.h>

int main() {
    // options
    unsigned int n = 60;        // autocorr window length
    unsigned int delay = 20;    // autocorr overlap delay

    // create autocorrelator object
    autocorr_cccf q = autocorr_cccf_create(n,delay);

    float complex x;            // input sample
    float complex rxx;          // output auto-correlation

    // compute auto-correlation (repeat as necessary)
        autocorr_cccf_push(q, x);
        autocorr_cccf_execute(q, &rxx);

    // destroy autocorrelator object

A more detailed example is given in examples/autocorr_cccf_example.c in the main liquid project directory. Listed below is the full interface to the autocorr family of objects. While each method is listed for autocorr_cccf , the same functionality applies to autocorr_rrrf .

  • autocorr_cccf_create(N,d) creates and returns an autocorr object with a window size of \(N\) samples and a delay of \(d\) samples.
  • autocorr_cccf_destroy(q) destroys an autocorr object, freeing all internally-allocated memory.
  • autocorr_cccf_clear(q) clears the internal autocorr buffers.
  • autocorr_cccf_print(q) prints the internal state of the autocorr object.
  • autocorr_cccf_push(q,x) pushes a sample \(x\) into the internal buffer of an autocorr object.
  • autocorr_cccf_execute(q,*rxx) executes the delay, conjugate multiply, and accumulate operation, storing the result in the output variable \(r_{xx}\) .
  • autocorr_cccf_get_energy(q) returns \((1/N)\sum_{k=0}^{N-1}{|x(n-k)x^*(n-k-d)|}\)