1#ifndef STAN_MATH_PRIM_PROB_STD_NORMAL_LCCDF_HPP
2#define STAN_MATH_PRIM_PROB_STD_NORMAL_LCCDF_HPP
23 require_all_not_nonscalar_prim_or_rev_kernel_expression_t<T_y>* =
nullptr>
29 static constexpr const char* function =
"std_normal_lccdf";
37 T_partials_return lccdf(0.0);
43 for (
size_t n = 0; n < N; n++) {
44 const T_partials_return y_dbl = y_vec.val(n);
47 T_partials_return one_m_erf;
50 }
else if (y_dbl < -5.0) {
51 one_m_erf = 2.0 -
erfc(-scaled_y);
52 }
else if (y_dbl > 8.25) {
55 one_m_erf = 1.0 -
erf(scaled_y);
61 const T_partials_return rep_deriv
65 partials<0>(ops_partials)[n] -= rep_deriv;
69 return ops_partials.build(lccdf);
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
return_type_t< T_y_cl > std_normal_lccdf(const T_y_cl &y)
Returns the log standard normal complementary cumulative distribution function.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
static constexpr double LOG_HALF
The natural logarithm of 0.5, .
static constexpr double SQRT_TWO_OVER_SQRT_PI
The square root of 2 divided by the square root of , .
bool size_zero(const T &x)
Returns 1 if input is of length 0, returns 0 otherwise.
fvar< T > log(const fvar< T > &x)
fvar< T > erf(const fvar< T > &x)
static constexpr double INV_SQRT_TWO
The value of 1 over the square root of 2, .
fvar< T > erfc(const fvar< T > &x)
void check_not_nan(const char *function, const char *name, const T_y &y)
Check if y is not NaN.
auto make_partials_propagator(Ops &&... ops)
Construct an partials_propagator.
static constexpr double INFTY
Positive infinity.
fvar< T > exp(const fvar< T > &x)
typename ref_type_if< true, T >::type ref_type_t
typename partials_return_type< Args... >::type partials_return_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Extends std::true_type when instantiated with zero or more template parameters, all of which extend t...