Stan Math Library  2.9.0
reverse mode automatic differentiation
cholesky_decompose.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_DECOMPOSE_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_DECOMPOSE_HPP
3 
8 
9 namespace stan {
10  namespace math {
11 
23  template <typename T>
24  Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
25  cholesky_decompose(const Eigen::Matrix
26  <T, Eigen::Dynamic, Eigen::Dynamic>& m) {
27  stan::math::check_square("cholesky_decompose", "m", m);
28  stan::math::check_symmetric("cholesky_decompose", "m", m);
29  Eigen::LLT<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
30  llt(m.rows());
31  llt.compute(m);
32  stan::math::check_pos_definite("cholesky_decompose", "m", llt);
33  return llt.matrixL();
34  }
35 
36  }
37 }
38 #endif
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > cholesky_decompose(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &m)
Return the lower-triangular Cholesky factor (i.e., matrix square root) of the specified square...
bool check_pos_definite(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified square, symmetric matrix is positive definite.
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is symmetric.
bool check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is square.

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