Skip to content

Commit

Permalink
Moved DD3_diag definition out the loop (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed May 23, 2024
1 parent 5d3f495 commit ab3a5f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/admm_MADMMplasso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ arma::field<arma::cube> admm_MADMMplasso_cpp(
arma::mat b;
const arma::mat W_hat_t = W_hat.t();
arma::mat DD3(W_hat_t.n_rows, W_hat_t.n_rows);
arma::vec DD3_diag(W_hat_t.n_rows);
arma::mat part_z(W_hat_t.n_rows, W_hat_t.n_cols);
arma::vec part_y(W_hat_t.n_rows);
arma::vec my_beta_jj(W_hat_t.n_rows);
Expand Down Expand Up @@ -157,7 +158,7 @@ arma::field<arma::cube> admm_MADMMplasso_cpp(
arma::vectorise(rho * (EE.slice(jj) - HH.slice(jj)));

DD3 = arma::diagmat(1 / invmat.slice(jj));
arma::vec DD3_diag = arma::diagvec(DD3);
DD3_diag = arma::diagvec(DD3);
for (arma::uword j = 0; j < W_hat_t.n_cols; ++j) {
part_z.col(j) = DD3_diag % W_hat_t.col(j);
}
Expand Down

0 comments on commit ab3a5f7

Please sign in to comment.