Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cholesky_decompose.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__MATRIX__CHOLESKY_DECOMPOSE_HPP
2 #define STAN__MATH__MATRIX__CHOLESKY_DECOMPOSE_HPP
3 
7 
8 namespace stan {
9  namespace math {
10 
21  template <typename T>
22  Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>
23  cholesky_decompose(const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic>& m) {
24  stan::math::check_square("cholesky_decompose(%1%)",m,"m",(double*)0);
25  stan::math::check_symmetric("cholesky_decompose(%1%)",m,"m",(double*)0);
26  Eigen::LLT<Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> >llt(m.rows());
27  llt.compute(m);
28  return llt.matrixL();
29  }
30 
31  }
32 }
33 #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_symmetric(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is symmetric.
bool check_square(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is square.

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