1 #ifndef __STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_UNIT_VECTOR_HPP__
2 #define __STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_UNIT_VECTOR_HPP__
25 template <
typename T_prob,
29 const Eigen::Matrix<T_prob,Eigen::Dynamic,1>& theta,
35 if (theta.size() == 0) {
36 std::string message(name);
37 message +=
" is not a valid unit vector. %1% elements in the vector.";
38 T_result tmp = raise_domain_error<size_t, size_t>(
function,
46 T_prob ssq = theta.squaredNorm();
48 std::stringstream msg;
49 msg <<
"in function check_unit_vector(%1%), ";
50 msg << name <<
" is not a valid unit vector.";
51 msg <<
" The sum of the squares of the elements should be 1, but is " << ssq;
52 T_result tmp = raise_domain_error<T_result,T_prob>(
function,
62 template <
typename T_y,
65 const Eigen::Matrix<T_y,Eigen::Dynamic,1>& theta,
72 const Eigen::Matrix<T,Eigen::Dynamic,1>& theta,