Stan Math Library  2.6.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
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 
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
24  <T, Eigen::Dynamic, Eigen::Dynamic>& m) {
25  stan::math::check_square("cholesky_decompose", "m", m);
26  stan::math::check_symmetric("cholesky_decompose", "m", m);
27  Eigen::LLT<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
28  llt(m.rows());
29  llt.compute(m);
30  return llt.matrixL();
31  }
32 
33  }
34 }
35 #endif
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is symmetric.
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_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.