All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
check_ldlt_factor.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_LDLT_FACTOR_HPP
#define STAN_MATH_PRIM_MAT_ERR_CHECK_LDLT_FACTOR_HPP
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/scal/err/domain_error.hpp>
#include <stan/math/prim/mat/fun/LDLT_factor.hpp>
#include <sstream>
#include <string>
namespace stan {
namespace math {
template <typename T, int R, int C>
inline bool check_ldlt_factor(const char* function,
const char* name,
stan::math::LDLT_factor<T, R, C> &A) {
if (!A.success()) {
std::ostringstream msg;
msg << "is not positive definite. "
<< "last conditional variance is ";
std::string msg_str(msg.str());
const T too_small = A.vectorD().tail(1)(0);
domain_error(function, name, too_small,
msg_str.c_str(), ".");
return false;
}
return true;
}
}
}
#endif
stan::math::LDLT_factor< T, R, C >::success
bool success() const
Definition: LDLT_factor.hpp:74
LDLT_factor.hpp
stan::math::LDLT_factor< T, R, C >::vectorD
Eigen::Matrix< T, Eigen::Dynamic, 1 > vectorD() const
Definition: LDLT_factor.hpp:114
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:32
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:58
stan::math::check_ldlt_factor
bool check_ldlt_factor(const char *function, const char *name, stan::math::LDLT_factor< T, R, C > &A)
Return true if the argument is a valid stan::math::LDLT_factor.
Definition: check_ldlt_factor.hpp:34

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