Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_cholesky_factor.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_CHOLESKY_FACTOR_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_CHOLESKY_FACTOR_HPP
3 
8 
9 
10 namespace stan {
11  namespace math {
12 
29  template <typename T_y, typename T_result>
30  inline bool check_cholesky_factor(const char* function,
31  const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
32  const char* name,
33  T_result* result) {
34  check_less_or_equal(function,y.cols(),y.rows(),
35  "columns and rows of Cholesky factor",
36  result);
37  check_positive(function, y.cols(), "columns of Cholesky factor",
38  result);
39  // FIXME: should report row i
40  check_lower_triangular(function, y, name, result);
41  for (int i = 0; i < y.cols(); ++i)
42  check_positive(function, y(i,i), name, result);
43  return true;
44  }
45 
46  }
47 }
48 #endif
bool check_cholesky_factor(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 a valid Cholesky factor.
bool check_positive(const char *function, const T_y &y, const char *name, T_result *result)
bool check_less_or_equal(const char *function, const T_y &y, const T_high &high, const char *name, T_result *result)
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.