1#ifndef STAN_MATH_PRIM_ERR_CHECK_UNIT_VECTOR_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_UNIT_VECTOR_HPP
35template <
typename Vec, require_vector_t<Vec>* =
nullptr,
36 require_not_std_vector_t<Vec>* =
nullptr>
44 std::stringstream msg;
45 msg <<
"is not a valid unit vector."
46 <<
" The sum of the squares of the elements should be 1, but is ";
47 std::string msg_str(msg.str());
66template <
typename StdVec, require_std_vector_t<StdVec>* =
nullptr>
68 const StdVec& theta) {
69 for (
size_t i = 0; i < theta.size(); ++i) {
auto make_iter_name(const char *name)
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
void check_unit_vector(const char *function, const char *name, const Vec &theta)
Throw an exception if the specified vector does not have unit Euclidiean length.
void throw_domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
const double CONSTRAINT_TOLERANCE
The tolerance for checking arithmetic bounds in rank and in simplexes.
fvar< T > fabs(const fvar< T > &x)
typename scalar_type< T >::type scalar_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...