Skip to content

Commit

Permalink
Replace beta with std impl
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Dec 28, 2024
1 parent 9bae49d commit bb20cd7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions stan/math/prim/fun/beta.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef STAN_MATH_PRIM_FUN_BETA_HPP
#define STAN_MATH_PRIM_FUN_BETA_HPP

#include <stan/math/prim/meta.hpp>
#include <stan/math/prim/fun/exp.hpp>
#include <stan/math/prim/fun/lgamma.hpp>
#include <stan/math/prim/functor/apply_scalar_binary.hpp>
#include <cmath>

Expand Down Expand Up @@ -51,8 +48,7 @@ namespace math {
*/
template <typename T1, typename T2, require_all_arithmetic_t<T1, T2>* = nullptr>
inline return_type_t<T1, T2> beta(const T1 a, const T2 b) {
using std::exp;
return exp(lgamma(a) + lgamma(b) - lgamma(a + b));
return std::beta(a, b);
}

/**
Expand Down

0 comments on commit bb20cd7

Please sign in to comment.