Math utilities. More...
Functions | |
| template<typename Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
| constexpr Int | ilog (Int b, Int n) |
| Computes the logarithm log_b(n) for (b,n) integers. More... | |
| template<typename Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
| constexpr Int | ipow (Int b, Int e) |
| Computes integer pow using exponentiation by squaring Complexiy O(log(e)) | |
| template<typename Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
| constexpr Int | factorial (const Int n) noexcept |
| Computes the factorial of n. More... | |
| template<typename Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
| constexpr Int | binomial_coefficient (const Int n, const Int m) noexcept |
| Computes the binomial coefficient (n m) More... | |
| template<typename Float , CONCEPT_REQUIRES_(std::is_floating_point< Float >{}) > | |
| constexpr Float | floor (Float x) |
| Constexpr version of cmath floor. More... | |
Math utilities.
| constexpr Int hm3::math::ilog | ( | Int | b, |
| Int | n | ||
| ) |
Computes the logarithm log_b(n) for (b,n) integers.
|
noexcept |
Computes the factorial of n.
| n | [in] number whose factorial will be computed |
TODO: assert on overflow
Referenced by binomial_coefficient().
|
noexcept |
Computes the binomial coefficient (n m)
TODO: assert n - m >= 0 for unsigned types
References factorial().
Referenced by hm3::geometry::square< Nd >::no_edges().
| constexpr Float hm3::math::floor | ( | Float | x | ) |
Constexpr version of cmath floor.
TODO: there has to be a better way