Skip to content

Commit

Permalink
Fix universal references (Issue #2881)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbales2 committed Mar 15, 2021
1 parent 13d139f commit 83f551f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/stan/mcmc/hmc/hamiltonians/dense_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ class dense_e_point : public ps_point {
*
* @param inv_e_metric initial mass matrix
*/
void set_inv_metric(Eigen::MatrixXd&& inv_e_metric) {
inv_e_metric_ = std::forward<Eigen::MatrixXd>(inv_e_metric);
template <typename EigMat,
require_eigen_matrix_dynamic_t<EigMat>* = nullptr>
void set_inv_metric(EigMat&& inv_e_metric) {
inv_e_metric_ = std::forward<EigMat>(inv_e_metric);
inv_e_metric_llt_matrixU_ = inv_e_metric_.llt().matrixU();
}

Expand Down
6 changes: 4 additions & 2 deletions src/stan/mcmc/hmc/hamiltonians/diag_e_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ class diag_e_point : public ps_point {
*
* @param inv_e_metric initial mass matrix
*/
void set_inv_metric(Eigen::VectorXd&& inv_e_metric) {
inv_e_metric_ = std::forward<Eigen::VectorXd>(inv_e_metric);
template <typename EigVec,
require_eigen_vector_t<EigVec>* = nullptr>
void set_inv_metric(EigVec&& inv_e_metric) {
inv_e_metric_ = std::forward<EigVec>(inv_e_metric);
}

/**
Expand Down

0 comments on commit 83f551f

Please sign in to comment.