Skip to content

Commit

Permalink
Revert "narrow catch condition #43"
Browse files Browse the repository at this point in the history
This reverts commit c89c23b.
  • Loading branch information
adamwang15 committed Aug 10, 2024
1 parent 56a2659 commit e682d94
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/sample_hyper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#define ARMA_WARN_LEVEL 1
#include <RcppArmadillo.h>

#include "utils.h"
Expand Down Expand Up @@ -112,20 +111,19 @@ double log_ml(
mat inv_Omega = diagmat(1 / Omega.diag());

try {
mat XX = X.t() * X + inv_Omega;
mat Bhat = solve(XX, X.t() * Y + inv_Omega * b, solve_opts::likely_sympd);
mat Bhat = inv_sympd(X.t() * X + inv_Omega) * (X.t() * Y + inv_Omega * b);
mat ehat = Y - X * Bhat;

log_ml += - N * T / 2.0 * log(M_PI);
log_ml += log_mvgamma(N, (T + d) / 2.0);
log_ml += -log_mvgamma(N, d / 2.0);
log_ml += - N / 2.0 * log_det_sympd(Omega);
log_ml += d / 2.0 * log_det_sympd(Psi);
log_ml += - N / 2.0 * log_det_sympd(XX);
log_ml += - N / 2.0 * log_det_sympd(X.t() * X + inv_Omega);
mat A = Psi + ehat.t() * ehat + (Bhat - b).t() * inv_Omega * (Bhat - b);
log_ml += - (T + d) / 2.0 * log_det_sympd(A);

} catch(std::runtime_error) {
} catch(...) {
log_ml = -1e+10;
}

Expand Down

0 comments on commit e682d94

Please sign in to comment.