Stan Math Library  2.20.0
reverse mode automatic differentiation
is_cholesky_factor.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_IS_CHOLESKY_FACTOR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_IS_CHOLESKY_FACTOR_HPP
3 
9 
10 namespace stan {
11 namespace math {
12 
28 template <typename T_y>
29 inline bool is_cholesky_factor(
30  const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y) {
31  Eigen::Matrix<T_y, -1, 1> y_diag = y.diagonal();
32  return is_less_or_equal(y.cols(), y.rows()) && is_positive(y.cols())
33  && is_lower_triangular(y) && is_positive(y_diag);
34 }
35 
36 } // namespace math
37 } // namespace stan
38 #endif
bool is_cholesky_factor(const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if y is a valid Choleksy factor, if number of rows is not less than the number of columns...
bool is_positive(const T_y &y)
Return true if y is positive.
Definition: is_positive.hpp:18
bool is_less_or_equal(const T_y &y, const T_high &high)
Return true if y is less or equal to high.
bool is_lower_triangular(const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true is matrix is lower triangular.

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