Stan Math Library  2.14.0
reverse mode automatic differentiation
check_nonzero_size.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_NONZERO_SIZE_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_NONZERO_SIZE_HPP
3 
5 #include <string>
6 
7 namespace stan {
8  namespace math {
9 
26  template <typename T_y>
27  inline void check_nonzero_size(const char* function,
28  const char* name,
29  const T_y& y) {
30  if (y.size() > 0)
31  return;
32 
33  invalid_argument(function, name, 0,
34  "has size ",
35  ", but must have a non-zero size");
36  }
37 
38  }
39 }
40 #endif
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.
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.

     [ Stan Home Page ] © 2011–2016, Stan Development Team.