ginger/autocorr.hpp file

Typedefs

using Vec2 = numeric::Vector2<double>
using Mat2 = numeric::Matrix2<Vec2>

Functions

auto initial_autocorr(const std::vector<double>& coeffs) -> std::vector< Vec2 > -> auto
auto pbairstow_autocorr(const std::vector<double>& coeffs, std::vector<Vec2>& vrs, const Options& options) -> std::pair< unsigned int, bool > -> auto
Multi-threading Bairstow's method (specific for auto-correlation function)
void extract_autocorr(Vec2& vr)

Function documentation

auto initial_autocorr(const std::vector<double>& coeffs) -> std::vector< Vec2 >

Parameters
coeffs in The parameter coeffs is a vector of doubles.
Returns The function initial_autocorr returns a vector of Vec2 objects.

The function calculates the initial autocorrelation values (specific for auto-correlation function)

auto pbairstow_autocorr(const std::vector<double>& coeffs, std::vector<Vec2>& vrs, const Options& options) -> std::pair< unsigned int, bool >

Multi-threading Bairstow's method (specific for auto-correlation function)

Parameters
coeffs in polynomial
vrs in/out vector of iterates
options in maximum iterations and tolorance
Returns std::pair<unsigned int, bool>

The function pbairstow_autocorr is implementing the Bairstow's method for finding the roots of a real polynomial (specific for auto-correlation function)

void extract_autocorr(Vec2& vr)

Parameters
vr in/out The parameter vr is of type Vec2, which is a custom class representing a 2D vector. It contains two components, x and y, which are accessed using the x() and y() member functions respectively.

The function extracts the autocorrelation values from a given vector.

x^2 - r*x - q or (-1/q) + (r/q) * x + x^2 (x - a1)(x - a2) = x^2 - (a1 + a2) x + a1 * a2

x^2 + r*x + t or x^2 + (r/t) * x + (1/t) (x + a1)(x + a2) = x^2 + (a1 + a2) x + a1 * a2