1 #ifndef STAN_MATH_PRIM_SCAL_FUN_CHOOSE_HPP 2 #define STAN_MATH_PRIM_SCAL_FUN_CHOOSE_HPP 6 #include <boost/math/special_functions/binomial.hpp> 33 const double choices = boost::math::binomial_coefficient<double>(n, k);
37 return static_cast<int>(choices < 0 ? choices - 0.5 : choices + 0.5);
void check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high)
Check if y is less or equal to high.
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
int choose(int n, int k)
Return the binomial coefficient for the specified integer arguments.
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.