Numerical algorithm libraries most functions support both iterator and variadics.
More...
|
| template<typename ... Ints, std::enable_if_t< conjunction< std::is_integral< Ints >... >::value, int > = 0> |
| constexpr auto | int_average (Ints... ints) |
| | get average value of integers(result is floored) More...
|
| |
| template<typename T , typename U , typename E = std::common_type_t<T, U>> |
| constexpr bool | float_equal (const T &a, const U &b, const E &epsilon=vccc::epsilon< E >()) |
| | Compare if two floating-points are approximately equal. More...
|
| |
| template<typename T1 , typename T2 > |
| decltype(auto) | lossless_div (const T1 a, const T2 b) |
| | divide without narrowing More...
|
| |
| template<typename InputIterator > |
| auto | avg_stddev (InputIterator first, InputIterator last) |
| | calculate standard deviation and average More...
|
| |
| template<typename T > |
| constexpr T | square (const T &val) |
| | get squared value More...
|
| |
◆ avg_stddev()
| auto vccc::avg_stddev |
( |
InputIterator |
first, |
|
|
InputIterator |
last |
|
) |
| |
- Returns
- pair of average and standard deviation
◆ float_equal()
| constexpr bool vccc::float_equal |
( |
const T & |
a, |
|
|
const U & |
b, |
|
|
const E & |
epsilon = vccc::epsilon<E>() |
|
) |
| |
|
inlineconstexpr |
Default epsilon values are 4.92157e-03f for float and 6.0554545e-06 for double type.
The values must be representable
Return true if both values are smaller or same with epsilon.
Otherwise, return true if diff <= std::min(std::abs(a), std::abs(b)) * epsilon, false otherwise
where diff is std::abs(a - b).
- See also
- float_equal_to: function object implementing approximately equal of x and y
- Template Parameters
-
- Parameters
-
- Returns
◆ int_average()
| constexpr auto vccc::int_average |
( |
Ints... |
ints | ) |
|
|
inlineconstexpr |
◆ lossless_div()
| decltype(auto) vccc::lossless_div |
( |
const T1 |
a, |
|
|
const T2 |
b |
|
) |
| |
- Parameters
-
- Returns
- \( {\large \frac{a}{b}} \)
◆ square()
| constexpr T vccc::square |
( |
const T & |
val | ) |
|
|
constexpr |
- Parameters
-
- Returns
val * val