| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/mat/err/check_square.hpp>
6 #include <stan/math/prim/mat/err/check_symmetric.hpp>
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
stan::math::check_symmetric
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.
Definition: check_symmetric.hpp:38
check_symmetric.hpp
Eigen.hpp
stan::math::cholesky_decompose
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...
Definition: cholesky_decompose.hpp:23
stan::math::check_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.
Definition: check_square.hpp:28
check_square.hpp

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