| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

check_ldlt_factor.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_LDLT_FACTOR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_LDLT_FACTOR_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/scal/err/domain_error.hpp>
6 #include <stan/math/prim/mat/fun/LDLT_factor.hpp>
7 #include <sstream>
8 #include <string>
9
10 namespace stan {
11 namespace math {
12
33 template <typename T, int R, int C>
34 inline bool check_ldlt_factor(const char* function,
35 const char* name,
36 LDLT_factor<T, R, C> &A) {
37 if (!A.success()) {
38 std::ostringstream msg;
39 msg << "is not positive definite. "
40 << "last conditional variance is ";
41 std::string msg_str(msg.str());
42 const T too_small = A.vectorD().tail(1)(0);
43 domain_error(function, name, too_small,
44 msg_str.c_str(), ".");
45 return false;
46 }
47 return true;
48 }
49
50 }
51 }
52 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::check_ldlt_factor
bool check_ldlt_factor(const char *function, const char *name, LDLT_factor< T, R, C > &A)
Return true if the argument is a valid LDLT_factor.
Definition: check_ldlt_factor.hpp:34
stan::math::LDLT_factor< T, R, C >::success
bool success() const
Definition: LDLT_factor.hpp:72
LDLT_factor.hpp
stan::math::LDLT_factor< T, R, C >::vectorD
Eigen::Matrix< T, Eigen::Dynamic, 1 > vectorD() const
Definition: LDLT_factor.hpp:105
stan::math::domain_error
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.
Definition: domain_error.hpp:30
Eigen.hpp
domain_error.hpp
stan::math::LDLT_factor< T, R, C >
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–2016, Stan Development Team.