Stan Math Library  2.20.0
reverse mode automatic differentiation
check_lower_triangular.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_LOWER_TRIANGULAR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_LOWER_TRIANGULAR_HPP
3 
7 #include <sstream>
8 #include <string>
9 
10 namespace stan {
11 namespace math {
12 
26 template <typename T_y>
28  const char* function, const char* name,
29  const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y) {
30  for (int n = 1; n < y.cols(); ++n) {
31  for (int m = 0; m < n && m < y.rows(); ++m) {
32  if (y(m, n) != 0) {
33  std::stringstream msg;
34  msg << "is not lower triangular;"
35  << " " << name << "[" << stan::error_index::value + m << ","
36  << stan::error_index::value + n << "]=";
37  std::string msg_str(msg.str());
38  domain_error(function, name, y(m, n), msg_str.c_str());
39  }
40  }
41  }
42 }
43 
44 } // namespace math
45 } // namespace stan
46 #endif
void check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is lower triangular.
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.

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