1 #ifndef STAN_MATH_PRIM_SCAL_PROB_STD_NORMAL_LPDF_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_STD_NORMAL_LPDF_HPP 25 template <
bool propto,
typename T_y>
27 static const char*
function =
"std_normal_lpdf";
40 T_partials_return logp(0.0);
41 for (
size_t n = 0; n <
length(y); n++) {
42 const T_partials_return y_val =
value_of(y_vec[n]);
43 logp += y_val * y_val;
45 ops_partials.
edge1_.partials_[n] -= y_val;
50 return ops_partials.
build(logp);
53 template <
typename T_y>
55 return std_normal_lpdf<false>(y);
boost::math::tools::promote_args< double, typename partials_type< typename scalar_type< T >::type >::type, typename partials_return_type< T_pack... >::type >::type type
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Extends std::true_type when instantiated with zero or more template parameters, all of which extend t...
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
This template builds partial derivatives with respect to a set of operands.
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
bool size_zero(T &x)
Returns 1 if input is of length 0, returns 0 otherwise.
Template metaprogram to calculate whether a summand needs to be included in a proportional (log) prob...
boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
void check_not_nan(const char *function, const char *name, const T_y &y)
Check if y is not NaN.
return_type< T_y >::type std_normal_lpdf(const T_y &y)
The log of the normal density for the specified scalar(s) given a location of 0 and a scale of 1...
T_return_type build(double value)
Build the node to be stored on the autodiff graph.
const double NEG_LOG_SQRT_TWO_PI
internal::ops_partials_edge< double, Op1 > edge1_