Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_ldlt_factor.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_LDLT_FACTOR_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_LDLT_FACTOR_HPP
3 
4 #include <sstream>
8 
9 namespace stan {
10  namespace math {
11 
23  template <typename T, int R, int C, typename T_result>
24  inline bool check_ldlt_factor(const char* function,
26  const char* name,
27  T_result* result) {
28  if (!A.success()) {
29  std::ostringstream message;
30  message << "underlying matrix is not positive definite. "
31  << name << "last conditional variance is %1%.";
32  std::string msg(message.str());
33  const T_result too_small = A.vectorD().tail(1)(0);
34  return dom_err(function,too_small,name,msg.c_str(),"",result);
35  }
36  return true;
37  }
38 
39  }
40 }
41 #endif
Eigen::Matrix< T, Eigen::Dynamic, 1 > vectorD() const
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_ldlt_factor(const char *function, stan::math::LDLT_factor< T, R, C > &A, const char *name, T_result *result)
Return true if the underlying matrix is positive definite.
LDLT_factor is a thin wrapper on Eigen::LDLT to allow for reusing factorizations and efficient autodi...
Definition: LDLT_factor.hpp:56

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