Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_lower_triangular.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_LOWER_TRIANGULAR_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_LOWER_TRIANGULAR_HPP
3 
4 #include <sstream>
6 #include <stan/meta/traits.hpp>
8 
9 namespace stan {
10 
11  namespace math {
12 
26  template <typename T_y, typename T_result>
27  inline bool check_lower_triangular(const char* function,
28  const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
29  const char* name,
30  T_result* result) {
31  for (int n = 1; n < y.cols(); ++n) {
32  for (int m = 0; m < n && m < y.rows(); ++m) {
33  if (y(m,n) != 0) {
34  std::stringstream msg;
35  msg << name << " is not lower triangular;"
36  << " " << name << "[" << stan::error_index::value + m << ","
37  << stan::error_index::value + n << "]="
38  << "%1%";
39  std::string msg_string(msg.str());
40  return dom_err(function,y(m,n),"",msg_string.c_str(),"",result);
41  }
42  }
43  }
44  return true;
45  }
46 
47  }
48 }
49 #endif
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
Definition: dom_err.hpp:36
bool check_lower_triangular(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is lower triangular.

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