WPILibC++ 2023.4.3-108-ge5452e3
binomial_coef.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::binomial_coef_recur (const T n, const T k) noexcept
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
constexpr T internal::binomial_coef_check (const T n, const T k) noexcept
 
template<typename T1 , typename T2 , typename TC = common_t<T1,T2>>
constexpr TC internal::binomial_coef_type_check (const T1 n, const T2 k) noexcept
 
template<typename T1 , typename T2 >
constexpr common_t< T1, T2 > binomial_coef (const T1 n, const T2 k) noexcept
 Compile-time binomial coefficient. More...
 

Function Documentation

◆ binomial_coef()

template<typename T1 , typename T2 >
constexpr common_t< T1, T2 > binomial_coef ( const T1  n,
const T2  k 
)
constexprnoexcept

Compile-time binomial coefficient.

Parameters
nintegral-valued input.
kintegral-valued input.
Returns
computes the Binomial coefficient

\[ \binom{n}{k} = \frac{n!}{k!(n-k)!} \]

also known as 'n choose k '.