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

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::log_binomial_coef_compute (const T n, const T k) noexcept
 
template<typename T1 , typename T2 , typename TC = common_return_t<T1,T2>>
constexpr TC internal::log_binomial_coef_type_check (const T1 n, const T2 k) noexcept
 
template<typename T1 , typename T2 >
constexpr common_return_t< T1, T2 > log_binomial_coef (const T1 n, const T2 k) noexcept
 Compile-time log binomial coefficient. More...
 

Function Documentation

◆ log_binomial_coef()

template<typename T1 , typename T2 >
constexpr common_return_t< T1, T2 > log_binomial_coef ( const T1  n,
const T2  k 
)
constexprnoexcept

Compile-time log binomial coefficient.

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

\[ \ln \frac{n!}{k!(n-k)!} = \ln \Gamma(n+1) - [ \ln \Gamma(k+1) + \ln \Gamma(n-k+1) ] \]