Add exp_quad_chol function
Open
@rtrangucci is already working on this.
Since Mar 4, 2017.
feature
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Summary:
Generate the cholesky factor of an exponentiated quadratic covariance matrix.
Description:
The prim implementation will look something like this:
template<typename T_x, typename T_alpha, typename T_rho, typename T_sigma>
Eigen::Matrix exp_quad_chol(std::vector<T_x> x,
T_alpha alpha,
T_rho rho,
T_sigma sigma) {
check_positive("exp_quad_chol", "marginal variance", alpha);
check_positive("exp_quad_chol", "length-scale", rho);
check_positive("exp_quad_chol", sigma);
typedef typename stan::return_type<T_x, T_alpha, T_rho, T_sigma>::type T_scal;
Eigen::Matrix<T_scal, -1, -1> cov = cov_exp_quad(x, alpha, rho);
for (int i = 0; i < cov.rows(); ++i)
cov(i, i) = cov(i, i) + square(sigma);
Eigen::Matrix<T_scal, -1, -1> L_cov = cholesky_decompose(cov);
return L_cov
}
Additional Information:
Will need to be coupled with a rename of the parameters in cov_exp_quad. See #495.
Current Version:
v2.14.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.