Number rounding and other common utility functions
More...
|
template<class S , class T , int N> |
Vector< T, N > | operator* (S a, const Vector< T, N > &b) |
| Multiply a scalar with a vector.
|
|
|
template<template< class > class Vector, class Complex > |
void | fft (Vector< Complex > *vf, const Vector< Complex > &vt) |
| Translate vt from time domain to vf in frequency domain.
|
|
template<template< class > class Vector, class Complex > |
void | fft (Vector< Complex > *v) |
| Translate v in-place from time domain to frequency domain.
|
|
template<template< class > class Vector, class Complex > |
void | ift (Vector< Complex > *vf, const Vector< Complex > &vt) |
| Translate vf from frequency domain to vt in time domain.
|
|
template<template< class > class Vector, class Complex > |
void | ift (Vector< Complex > *v) |
| Translate v in-place from frequency domain to time domain.
|
|
|
double | roundNearestOrOut (double x) |
| Round x towards nearest integral number or if ambigious towards +-infinity.
|
|
double | roundNearestOrIn (double x) |
| Round x towards nearest integral number or if ambigious towards zero.
|
|
double | roundNearestOrIn (double x, double y) |
| Round x towards the nearest multiple of y or if ambiguous towards zero.
|
|
double | roundNearestOrOut (double x, double y) |
| Round x towards the nearest multiple of y or if ambiguous towards +-infinity.
|
|
double | roundOut (double x) |
| Round x towards next integral number towards +-infinity.
|
|
double | roundIn (double x) |
| Round x towards next integral number towards zero.
|
|
double | roundUp (double x) |
| Round x towards the next integral number towards +infinity.
|
|
double | roundDown (double x) |
| Round x towards the next integral number towards -infinity.
|
|
template<class G , class X > |
X | downToNext (G g, X x) |
| Round x down to the next multiple of a whole number g.
|
|
template<class G , class X > |
X | upToNext (G g, X x) |
| Round x up to the next multiple of a whole number g.
|
|
template<int B> |
int | ilog (int n) |
| Rounded up logarithm of n to base B.
|
|
|
template<class T > |
int | sign (T x) |
| Return sign of x -1 if x < 0, +1 if x >= 0)
|
|
template<class T > |
int | sgn (T x) |
| Return signum of x (-1 if x < 0, +1 if x > 0, 0 if x == 0)
|
|
template<class T > |
T | bound (T min, T x, T max) |
| Limit x to the range [min, max].
|
|
Number rounding and other common utility functions
◆ fft() [1/2]
template<template< class > class Vector, class Complex >
void fft |
( |
Vector< Complex > * | vf, |
|
|
const Vector< Complex > & | vt ) |
Translate vt from time domain to vf in frequency domain.
◆ fft() [2/2]
template<template< class > class Vector, class Complex >
void fft |
( |
Vector< Complex > * | v | ) |
|
Translate v in-place from time domain to frequency domain.
◆ ift() [1/2]
template<template< class > class Vector, class Complex >
void ift |
( |
Vector< Complex > * | vf, |
|
|
const Vector< Complex > & | vt ) |
Translate vf from frequency domain to vt in time domain.
◆ ift() [2/2]
template<template< class > class Vector, class Complex >
void ift |
( |
Vector< Complex > * | v | ) |
|
Translate v in-place from frequency domain to time domain.
◆ roundNearestOrOut() [1/2]
double roundNearestOrOut |
( |
double | x | ) |
|
Round x towards nearest integral number or if ambigious towards +-infinity.
◆ sign()
Return sign of x -1 if x < 0, +1 if x >= 0)
◆ operator*()
template<class S , class T , int N>
Multiply a scalar with a vector.
◆ roundNearestOrIn() [1/2]
double roundNearestOrIn |
( |
double | x | ) |
|
Round x towards nearest integral number or if ambigious towards zero.
◆ roundNearestOrIn() [2/2]
double roundNearestOrIn |
( |
double | x, |
|
|
double | y ) |
Round x towards the nearest multiple of y or if ambiguous towards zero.
◆ roundNearestOrOut() [2/2]
double roundNearestOrOut |
( |
double | x, |
|
|
double | y ) |
Round x towards the nearest multiple of y or if ambiguous towards +-infinity.
◆ roundOut()
double roundOut |
( |
double | x | ) |
|
Round x towards next integral number towards +-infinity.
◆ roundIn()
double roundIn |
( |
double | x | ) |
|
Round x towards next integral number towards zero.
◆ roundUp()
double roundUp |
( |
double | x | ) |
|
Round x towards the next integral number towards +infinity.
◆ roundDown()
double roundDown |
( |
double | x | ) |
|
Round x towards the next integral number towards -infinity.
◆ downToNext()
template<class G , class X >
X downToNext |
( |
G | g, |
|
|
X | x ) |
Round x down to the next multiple of a whole number g.
◆ upToNext()
template<class G , class X >
Round x up to the next multiple of a whole number g.
◆ ilog()
Rounded up logarithm of n to base B.
◆ sgn()
Return signum of x (-1 if x < 0, +1 if x > 0, 0 if x == 0)
◆ bound()
template<class T >
T bound |
( |
T | min, |
|
|
T | x, |
|
|
T | max ) |
Limit x to the range [min, max].