General functions

#include "dsp/dsp.hpp"


Sub-groups

Signal generation
Signal generation.

Date / time
Classes to manipulate dates, times, calendars, durations, etc.

Miscellaneous functions
Miscellaneous functions.

Types

using dsp::cfloat = typedef tsd::cfloat
Short-cut for the complex 32 bits floating point type.

using dsp::cdouble = typedef tsd::cdouble
Short-cut for the complex 32 bits floating point type.

using dsp::Tableau = typedef TabT<t,2>

using dsp::Vector = typedef VecT<t>
Shortcut for a column vector with generic (templated) data type.

using dsp::Configurable = typedef tsd::Configurable<C>
Abstract configurable structure.

using dsp::Void = typedef tsd::Void

using dsp::SinkGen = typedef tsd::SinkGen<Te>
Abstract data sink.

using dsp::Sink = typedef tsd::Sink<Te, Tc>
Abstract, configurable, data sink.

using dsp::SourceGen = typedef tsd::SourceGen<Ts>
Abstract data source.

using dsp::Source = typedef tsd::Source<Ts, C>
Abstract, configurable, data source.

using dsp::FilterGen = typedef tsd::FiltreGen<Te, Ts>
Generic data filter.

using dsp::Filter = typedef tsd::Filtre<Te, Ts, Tc>
Generic, run-time configurable, filter.

Variables and constants

const auto dsp::π_f
\(\pi\) value, with 32 bits floating point accuracy.

const auto dsp::π
\(\pi\) value, with 64 bits floating point accuracy.

const cfloat dsp::
Imaginary unit ( \(\sqrt{-1}\)), with 32 bits floating point accuracy.

const cdouble dsp::ⅈ_d
Imaginary unit ( \(\sqrt{-1}\)), with 64 bits floating point accuracy.

Functions

auto vconcat(const Vector<T1> &a, const Vector<T2> &b)
Vertical concatenation of 2 vectors.

auto operator|(const Vector<T1> &a, const Vector<T2> &b)
Vertical concatenation of 2 vectors (shortcut).

auto vconcat(const Tableau<T> &a, const Tableau<T> &b)
Vertical concatenation of two 2d arrays.

auto hconcat(const Tableau<T> &a, const Tableau<T> &b)
Horizontal concatenation of two 2d arrays.

Vector<T> rotation_vec(const Vector<T> &x, int d)
Vector rotation.

auto diff(const Vector<T> &x)
Difference between 2 successive elements of a vector.

auto cumsum(const Vector<T> &x)
Accumulated sum of a vector.

Vector<T> phase_unwrap(const Vector<T> &x, float r=2 *π)
Fix phase jumps.

vector<int> find(const Vecb &x)
Find true values indexes in a boolean vector.

int find_first(const Vecb &x)
Find the first true element index from a boolean vector.

int find_last(const Vecb &x)
Find the last true element index from a boolean vector.

int find_first_local_max(const Vector<T> &x)
Lookup for the first local maximum (a value greater than the ones of its neighbors).

Vector<T> downsample(const Vector<T> &x, int pas)
Decimation of a column vector.

Vector<T> upsample(const Vector<T> &x, int R)
Oversampling of a column vector.

auto pow2db(const T &x)
Linear to decibel conversion.

auto db2pow(const T &x)
Decibels to linear conversion.

auto mag2db(const auto &x)
Magnitude to decibel conversion.

auto db2mag(const auto &x)
Decibel to magnitude conversion.

int next_power_of_2(unsigned int i)
Returns the smallest power of 2 greater or equal to i.

tuple<Vector<T1>, Vector<T2>> pad_zeros(const Vector<T1> &x, const Vector<T2> &y, bool p2=false)
Add zeros at the end of one of two vectors such as they have the same length.

T square(const T &v)
Computes the square of a scalar value.

auto resample(const Vector<T> &x, float r)
Finite signal resampling, with arbitrary ratio.

sptr<Sink<T, int>> buffer_new(int N, fonction<void(const Vector<T> &)> callback)
From an input data stream, formatted in arbitrary packet sizes, produce a data stream with a fixed packet length.

T modulo(T x, T m)
Modulo with result in \([0,m[\) interval.

T modulo_2π(T x)
Computes \(a\) modulo \(2\pi\), the result being in the \(\left[0,2\pi\right[\) interval.

T modulo_pm_π(T x)
Computes \(a\) modulo \(2\pi\), the result being in the \(\left[-\pi,\pi\right[\) interval.

bool is_even(T &t)

bool is_odd(T &t)

auto deg2rad(T degrees)
Degrees to radians conversion.

T rad2deg(T radians)
Radians to degrees conversion.