Giter VIP home page Giter VIP logo

apachehigh5 / autocorrelation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeanolivier/autocorrelation

0.0 0.0 0.0 27 KB

C and Python interfaces to calculate the autocorrelation vs. lag of a signal. Supports considering only a certain bit of the input bytes. Useful for max_lag << input size. Tries to be somewhat memory efficient. Uses MPRF for precision, OpenMP for speed.

C 70.70% Python 24.61% Makefile 4.68%

autocorrelation's Introduction

autocorrelation.{c, py}

C and Python interfaces to compute the autocorrelation vs. lag of a signal.

Description

autocorrelation.c provides functions to compute the autocorrelation of a signal for the k first lags/delays. autocorrelation.py is a python interface for the C code.

Algorithm and optimisation

The algorithm used is the following:

,

where is the point of the signal, is its length, is its mean, and is its variance.

We re-express it as :

,

with

,

in order to speed up calculations with simple parallelizable forms for and and correcting for the induced errors using the relatively simple and .

In the case, it falls back to the variance normalized by itself (a.k.a. 1) and the corrections vanish.

Other details

  • It can comput the autocorrelations using the whole bytes or for each bits of every byte.
  • The whole input file is loaded into memory, but it's otherwise trying to be memory efficient.
  • MPFR is used for precision when working with big numbers.
  • openMP is used for parallelisation; some of the code might be suboptimal for single threaded execution.

Compiling

Using make

Simply execute make all

Manually

  • To compile a binary: gcc -O3 autocorrelation.c -o autocorrelation.out -Wall -lmpfr -lgmp -fopenmp
  • To compile a shared library: gcc -O3 -fPIC -shared autocorrelation.c -o autocorrelation.so -Wall -lmpfr -lgmp -fopenmp

For linux, add -DUNIX.

autocorrelation's People

Contributors

jeanolivier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.