1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_FINITE_HPP 2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_FINITE_HPP 3 4 #include <stan/math/prim/scal/err/check_positive.hpp> 5 #include <stan/math/prim/scal/err/check_finite.hpp> 6 7 namespace stan { 8 namespace math { 9 10 /** 11 * Check if <code>y</code> is positive and finite. 12 * 13 * This function is vectorized and will check each element of 14 * <code>y</code>. 15 * 16 * @tparam T_y Type of y 17 * 18 * @param function Function name (for error messages) 19 * @param name Variable name (for error messages) 20 * @param y Variable to check 21 * 22 * @throw <code>domain_error</code> if any element of y is not positive or 23 * if any element of y is NaN. 24 */ 25 template <typename T_y> check_positive_finite(const char * function,const char * name,const T_y & y)26inline void check_positive_finite(const char* function, const char* name, 27 const T_y& y) { 28 check_positive(function, name, y); 29 check_finite(function, name, y); 30 } 31 32 } // namespace math 33 } // namespace stan 34 #endif 35