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

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

read_cov_L.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_READ_COV_L_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_READ_COV_L_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/scal/fun/constants.hpp>
6
7 namespace stan {
8
9 namespace math {
10
21 template <typename T>
22 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
23 read_cov_L(const Eigen::Array<T, Eigen::Dynamic, 1>& CPCs,
24 const Eigen::Array<T, Eigen::Dynamic, 1>& sds,
25 T& log_prob) {
26 size_t K = sds.rows();
27 // adjust due to transformation from correlations to covariances
28 log_prob += (sds.log().sum() + stan::math::LOG_2) * K;
29 return sds.matrix().asDiagonal() * read_corr_L(CPCs, K, log_prob);
30 }
31
32
33 }
34
35 }
36
37 #endif
stan::math::LOG_2
const double LOG_2
The natural logarithm of 2, .
Definition: constants.hpp:33
stan::math::read_cov_L
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_cov_L(const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, const Eigen::Array< T, Eigen::Dynamic, 1 > &sds, T &log_prob)
This is the function that should be called prior to evaluating the density of any elliptical distribu...
Definition: read_cov_L.hpp:23
stan
Definition: log_sum_exp.hpp:8
Eigen.hpp
stan::math::read_corr_L
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > read_corr_L(const Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, const size_t K)
Return the Cholesky factor of the correlation matrix of the specified dimensionality corresponding to...
Definition: read_corr_L.hpp:41
constants.hpp

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