Skip to content

Commit

Permalink
update src cpp to fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
SpatLyu committed Dec 5, 2024
1 parent 1960e48 commit 960b820
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
16 changes: 10 additions & 6 deletions src/hsar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ List hsar_cpp_arma(arma::mat X, arma::vec y, arma::sp_mat W, arma::sp_mat M,
mat T0 = 100.0 * eye<mat>(p,p);

//completely non-informative priors
int c0(0.01);
int d0(0.01);
int a0(0.01);
int b0(0.01);
double c0 = 0.01;
double d0 = 0.01;
double a0 = 0.01;
double b0 = 0.01;
// int c0(0.01);
// int d0(0.01);
// int a0(0.01);
// int b0(0.01);

//Store MCMC results
mat Betas = zeros(Nsim-burnin, p);
Expand All @@ -108,8 +112,8 @@ List hsar_cpp_arma(arma::mat X, arma::vec y, arma::sp_mat W, arma::sp_mat M,
float rho_i(rho_start), rho_ip1(rho_start);
float lambda_i(lambda_start), lambda_ip1(lambda_start);

int ce( n/2 + c0 );
int au( Utotal/2 + a0 );
int ce(n/2 + c0);
int au(Utotal/2 + a0);

//Fixed matrix manipulations during the MCMC loops
mat XTX = trans(X) * X;
Expand Down
12 changes: 8 additions & 4 deletions src/hsar_lambda_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ List hsar_cpp_arma_lambda_0(arma::mat X, arma::vec y, arma::sp_mat W,
mat T0 = 100.0 * eye<mat>(p,p);

//completely non-informative priors
int c0(0.01);
int d0(0.01);
int a0(0.01);
int b0(0.01);
double c0 = 0.01;
double d0 = 0.01;
double a0 = 0.01;
double b0 = 0.01;
// int c0(0.01);
// int d0(0.01);
// int a0(0.01);
// int b0(0.01);

//Store MCMC results
mat Betas = zeros(Nsim-burnin, p);
Expand Down
12 changes: 8 additions & 4 deletions src/hsar_rho_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ List hsar_cpp_arma_rho_0(arma::mat X, arma::vec y, arma::sp_mat M,
mat T0 = 100.0 * eye<mat>(p,p);

//completely non-informative priors
int c0(0.01);
int d0(0.01);
int a0(0.01);
int b0(0.01);
double c0 = 0.01;
double d0 = 0.01;
double a0 = 0.01;
double b0 = 0.01;
// int c0(0.01);
// int d0(0.01);
// int a0(0.01);
// int b0(0.01);

//Store MCMC results
mat Betas = zeros(Nsim-burnin, p);
Expand Down
6 changes: 4 additions & 2 deletions src/sar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ List sar_cpp_arma(arma::mat X, arma::vec y, arma::sp_mat W, arma::mat detval,
mat T0 = 100.0 * eye<mat>(p,p);

//completely non-informative priors
int c0(0.01);
int d0(0.01);
double c0 = 0.01;
double d0 = 0.01;
// int c0(0.01);
// int d0(0.01);

//Store MCMC results
mat Betas = zeros(Nsim-burnin, p);
Expand Down

0 comments on commit 960b820

Please sign in to comment.