Stan Math Library: stan/math/prim/mat/err/check_cholesky_factor.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/scal/err/check_positive.hpp>
6 #include <stan/math/prim/scal/err/check_less_or_equal.hpp>
7 #include <stan/math/prim/mat/err/check_lower_triangular.hpp>
8
9
10 namespace stan {
11 namespace math {
33 template <typename T_y>
34 inline bool
35 check_cholesky_factor(
36 const char* function,
37 const char* name,
38 const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y
39 ) {
40 check_less_or_equal(function, "columns and rows of Cholesky factor",
41 y.cols(), y.rows());
42 check_positive(function, "columns of Cholesky factor", y.cols());
43 check_lower_triangular(function, name, y);
44 for (int i = 0; i < y.cols(); ++i)
45 // FIXME: should report row
46 check_positive(function, name, y(i, i));
47 return true;
48 }
49
50 }
51 }
52 #endif
stan::math::check_cholesky_factor
bool check_cholesky_factor(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is a valid Cholesky factor.
Definition: check_cholesky_factor.hpp:35
check_positive.hpp
stan
Definition: log_sum_exp.hpp:8
check_lower_triangular.hpp
stan::math::check_lower_triangular
bool check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is lower triangular.
Definition: check_lower_triangular.hpp:34
check_less_or_equal.hpp
stan::math::check_positive
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
Definition: check_positive.hpp:68
Eigen.hpp
stan::math::check_less_or_equal
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.
Definition: check_less_or_equal.hpp:81

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