Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
check_cholesky_factor.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_CHOLESKY_FACTOR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_CHOLESKY_FACTOR_HPP
3 
8 
9 
10 namespace stan {
11  namespace math {
12  using Eigen::Dynamic;
34  template <typename T_y>
35  inline bool
36  check_cholesky_factor(const char* function,
37  const char* name,
38  const Eigen::Matrix<T_y, Dynamic, Dynamic>& y) {
39  check_less_or_equal(function, "columns and rows of Cholesky factor",
40  y.cols(), y.rows());
41  check_positive(function, "columns of Cholesky factor", y.cols());
42  check_lower_triangular(function, name, y);
43  for (int i = 0; i < y.cols(); ++i)
44  // FIXME: should report row
45  check_positive(function, name, y(i, i));
46  return true;
47  }
48 
49  }
50 }
51 #endif
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
bool check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is less or equal to high.
bool check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is lower triangular.
bool check_cholesky_factor(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is a valid Cholesky factor.

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