Audio Processing Framework (APF) version 0.5.0
Classes | Namespaces | Functions
math.h File Reference

Mathematical constants and helper functions. More...

#include <cmath>
#include <iterator>
#include <numeric>
#include <algorithm>

Go to the source code of this file.

Classes

class  apf::math::raised_cosine< T >
 Raised cosine (function object). More...
 
class  apf::math::linear_interpolator< T, U >
 Function object for linear interpolation. More...
 
struct  apf::math::identity< T >
 Identity function object. Function call returns a const reference to input. More...
 

Namespaces

namespace  apf
 Audio Processing Framework.
 
namespace  apf::math
 Mathematical constants and helper functions.
 

Functions

template<typename T >
constexpr T apf::math::pi ()
 $\pi$. More...
 
template<>
constexpr float apf::math::pi< float > ()
 $\pi$. More...
 
template<>
constexpr double apf::math::pi< double > ()
 $\pi$. More...
 
template<>
constexpr long double apf::math::pi< long double > ()
 $\pi$. More...
 
template<typename T >
apf::math::pi_div_180 ()
 $\pi/180$ More...
 
template<typename T >
apf::math::square (T x)
 Product of a number with itself. More...
 
template<typename T >
apf::math::dB2linear (T L, bool power=false)
 Convert a level in decibel to a linear gain factor. More...
 
template<typename T >
apf::math::linear2dB (T x, bool power=false)
 Convert a linear gain factor to a level in dB. More...
 
template<typename T >
apf::math::deg2rad (T angle)
 Convert an angle in degrees to an angle in radians. More...
 
template<typename T >
apf::math::rad2deg (T angle)
 Convert an angle in radians to an angle in degrees. More...
 
template<typename T >
apf::math::fwrap (T x, T full)
 Wrap x into the interval [0, full). More...
 
template<typename T >
apf::math::wrap (T x, T full)
 Wrap x into the interval [0, full). More...
 
template<>
float apf::math::wrap (float x, float full)
 Wrap x into the interval [0, full). More...
 
template<>
double apf::math::wrap (double x, double full)
 Wrap x into the interval [0, full). More...
 
template<>
long double apf::math::wrap (long double x, long double full)
 Wrap x into the interval [0, full). More...
 
template<typename T >
apf::math::wrap_two_pi (T x)
 
template<typename T >
apf::math::next_power_of_2 (T number)
 Find a power of 2 which is >= a given number. More...
 
template<typename I >
std::iterator_traits< I >::value_type apf::math::max_amplitude (I begin, I end)
 Return the absolute maximum of a series of numbers. More...
 
template<typename I >
std::iterator_traits< I >::value_type apf::math::rms (I begin, I end)
 Root Mean Square (RMS) value of a series of numbers. More...
 
template<typename I >
bool apf::math::has_only_zeros (I first, I last)
 Check if there are only zeros in a range. More...
 
template<typename T >
linear_interpolator< T > apf::math::make_linear_interpolator (T first, T last)
 Helper function for automatic template type deduction. More...
 
template<typename T , typename U >
linear_interpolator< T, U > apf::math::make_linear_interpolator (T first, T last, U length)
 Helper function for automatic template type deduction. More...
 

Detailed Description

Mathematical constants and helper functions.

Definition in file math.h.