Stan Math Library: stan/math/prim/mat/fun/cholesky_decompose.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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_pos_definite.hpp>
6 #include <stan/math/prim/mat/err/check_square.hpp>
7 #include <stan/math/prim/mat/err/check_symmetric.hpp>
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
stan
Definition: log_sum_exp.hpp:8
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:25
stan::math::check_pos_definite
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.
Definition: check_pos_definite.hpp:37
stan::math::check_symmetric
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.
Definition: check_symmetric.hpp:37
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_pos_definite.hpp
check_square.hpp

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