Mathematical utilities. More...
Functions | |
template<class Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
constexpr Int | ipow (const Int b, const Int e) |
Computes b^e for (b,e) integers. More... | |
template<class Float , CONCEPT_REQUIRES_(std::is_floating_point< Float >{}) > | |
constexpr Float | floor (Float x) |
Constexpr version of cmath floor. More... | |
template<class Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
constexpr Int | factorial (const Int n) noexcept |
Computes the factorial of n. More... | |
template<class Int , CONCEPT_REQUIRES_(Integral< Int >{}) > | |
constexpr Int | binomial_coefficient (const Int n, const Int m) noexcept |
Computes the binomial coefficient (n m) More... | |
Mathematical utilities.
constexpr Int ndtree::v1::math::ipow | ( | const Int | b, |
const Int | e | ||
) |
Computes b^e for (b,e) integers.
TODO: assert on overflow
Referenced by ndtree::v1::bit::max_value(), ndtree::v1::shift_location_fn::operator()(), ndtree::v1::manifold_neighbors< nd, m >::operator[](), ndtree::v1::bit::to_int(), and ndtree::v1::bit::to_int_r().
constexpr Float ndtree::v1::math::floor | ( | Float | x | ) |
Constexpr version of cmath floor.
TODO: there has to be a better way
Referenced by ndtree::v1::tree< nd >::sibling_group().
|
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().