Vowpal Wabbit
Loading...
Searching...
No Matches
Functions | Variables
VW::math Namespace Reference

Functions

template<typename T >
bool are_same (T lhs, T rhs, T tolerance=0.0001)
 
template<typename T >
bool are_same_rel (T lhs, T rhs, T tolerance=0.0001)
 
VW_STD14_CONSTEXPR int64_t factorial (int64_t n) noexcept
 
int64_t number_of_combinations_with_repetition (int64_t n, int64_t k)
 Both n and k must be non-zero. More...
 
int64_t number_of_permutations_with_repetition (int64_t n, int64_t k)
 
constexpr float sign (float w) noexcept
 
VW_STD14_CONSTEXPR int64_t choose (int64_t n, int64_t k) noexcept
 C(n,k) = n!/(k!(n-k)!) More...
 
template<typename T >
VW_STD14_CONSTEXPR T clamp (const T &num, const T &lower_bound, const T &upper_bound)
 Clamp a value in the range [lower_bound, upper_bound]. More...
 

Variables

constexpr float DEFAULT_FLOAT_TOLERANCE = static_cast<float>( 0.0001 )
 

Function Documentation

◆ are_same()

template<typename T >
bool VW::math::are_same ( lhs,
rhs,
tolerance = 0.0001 
)

◆ are_same_rel()

template<typename T >
bool VW::math::are_same_rel ( lhs,
rhs,
tolerance = 0.0001 
)

◆ choose()

VW_STD14_CONSTEXPR int64_t VW::math::choose ( int64_t  n,
int64_t  k 
)
inlinenoexcept

C(n,k) = n!/(k!(n-k)!)

◆ clamp()

template<typename T >
VW_STD14_CONSTEXPR T VW::math::clamp ( const T &  num,
const T &  lower_bound,
const T &  upper_bound 
)

Clamp a value in the range [lower_bound, upper_bound].

Parameters
numvalue to clamp
lower_boundlower bound of clamp range
upper_boundupper bound of clamp range

◆ factorial()

VW_STD14_CONSTEXPR int64_t VW::math::factorial ( int64_t  n)
inlinenoexcept

◆ number_of_combinations_with_repetition()

int64_t VW::math::number_of_combinations_with_repetition ( int64_t  n,
int64_t  k 
)
inline

Both n and k must be non-zero.

◆ number_of_permutations_with_repetition()

int64_t VW::math::number_of_permutations_with_repetition ( int64_t  n,
int64_t  k 
)
inline

◆ sign()

constexpr float VW::math::sign ( float  w)
inlineconstexprnoexcept

Variable Documentation

◆ DEFAULT_FLOAT_TOLERANCE

constexpr float VW::math::DEFAULT_FLOAT_TOLERANCE = static_cast<float>( 0.0001 )
constexpr