Skip to content

Commit

Permalink
replace typedef with using
Browse files Browse the repository at this point in the history
  • Loading branch information
Young Geun Kim committed Dec 9, 2024
1 parent b1de004 commit 857340b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions inst/include/bvharcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ using Optional = boost::optional<T>;

namespace bvhar {

typedef Eigen::Matrix<double,Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> ColMajorMatrixXd;
using ColMajorMatrixXd = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>;

typedef Eigen::Matrix<bool, Eigen::Dynamic, 1> VectorXb;
using VectorXb = Eigen::Matrix<bool, Eigen::Dynamic, 1>;

template <typename Derived>
inline Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, 1> vectorize_eigen(const Eigen::MatrixBase<Derived>& x) {
Expand Down
11 changes: 4 additions & 7 deletions inst/include/bvharmcmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,7 @@ class McmcHorseshoe : public BaseMcmc {
);
}
horseshoe_latent(latent_local, local_lev, rng);
typedef std::integral_constant<bool, isGroup> is_group;
// if constexpr (isGroup) {
using is_group = std::integral_constant<bool, isGroup>;
if (is_group::value) {
horseshoe_latent(latent_global, global_lev, rng);
global_lev = horseshoe_global_sparsity(latent_global, coef_var.array() * local_lev.array(), coef_vec.head(num_alpha), 1, rng);
Expand Down Expand Up @@ -655,8 +654,7 @@ class McmcNg : public BaseMcmc {
);
}
ng_local_sparsity(local_lev, local_shape_fac, coef_vec.head(num_alpha), global_lev * coef_var, rng);
typedef std::integral_constant<bool, isGroup> is_group;
// if constexpr (isGroup) {
using is_group = std::integral_constant<bool, isGroup>;
if (is_group::value) {
global_lev = ng_global_sparsity(local_lev.array() / coef_var.array(), local_shape_fac, global_shape, global_scl, rng);
}
Expand Down Expand Up @@ -748,14 +746,13 @@ class McmcDl : public BaseMcmc {
coef_var
);
}
dl_latent(latent_local, global_lev * local_lev.array() * coef_var.array(), coef_vec.head(num_alpha), rng);
dl_dir_griddy(dir_concen, grid_size, local_lev, global_lev, rng);
dl_local_sparsity(local_lev, dir_concen, coef_vec.head(num_alpha).array() / coef_var.array(), rng);
typedef std::integral_constant<bool, isGroup> is_group;
// if constexpr (isGroup) {
using is_group = std::integral_constant<bool, isGroup>;
if (is_group::value) {
global_lev = dl_global_sparsity(local_lev.array() * coef_var.array(), dir_concen, coef_vec.head(num_alpha), rng);
}
dl_latent(latent_local, global_lev * local_lev.array() * coef_var.array(), coef_vec.head(num_alpha), rng);
prior_alpha_prec.head(num_alpha) = 1 / ((global_lev * local_lev.array() * coef_var.array()).square() * latent_local.array());
}
void updatePenalty() override {
Expand Down

0 comments on commit 857340b

Please sign in to comment.