1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_UNIT_VECTOR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_UNIT_VECTOR_HPP
37 template <
typename T_prob>
40 const Eigen::Matrix<T_prob, Dynamic, 1>& theta) {
42 T_prob ssq = theta.squaredNorm();
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());
fvar< T > fabs(const fvar< T > &x)
bool check_unit_vector(const char *function, const char *name, const Eigen::Matrix< T_prob, Dynamic, 1 > &theta)
Return true if the specified vector is unit vector.
const double CONSTRAINT_TOLERANCE
The tolerance for checking arithmetic bounds In rank and in simplexes.
bool check_nonzero_size(const char *function, const char *name, const T_y &y)
Return true if the specified matrix/vector is of non-zero size.
void 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.