Skip to content

Commit

Permalink
Updating RcppArmadillo initialization
Browse files Browse the repository at this point in the history
These changes update RcppArmadillo from the now deprecated <<
initialization to brace initialization allowed since C++11 and long
been the minimal standard with R too. It would be great if you could
merge this, and release and updated package "in the next little while"
-- see the two prior emails I sent, and the transition log at
RcppCore/RcppArmadillo#391
  • Loading branch information
eddelbuettel committed Sep 12, 2022
1 parent 25411af commit 8615ed1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/glog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ Rcpp::List glog(const arma::mat & y,
arma::uvec upg = ug(arma::find(ug>0));

std::vector<double> llike;
arma::uvec d;
d << 1;
arma::uvec d({ 1 });
int itr = 0;
do{
double lpenalty = 0.0;
Expand Down Expand Up @@ -249,8 +248,7 @@ Rcpp::List glog(const arma::mat & y,

std::vector<double> llike;

arma::uvec d;
d << 1;
arma::uvec d({ 1 });
int itr=0;
do{
// Majorization-Minization step for beta (use FISTA)
Expand Down Expand Up @@ -283,7 +281,7 @@ Rcpp::List glog(const arma::mat & y,
// ADMM: update the dual variable -- Z
arma::uvec uk;
for(int k = 0; k<K-1; ++k){
uk << k;
uk = { k };
new_Z(idx0,uk) = new_beta(idx0,uk) + U(idx0,uk);

arma::uvec idx1;
Expand Down Expand Up @@ -317,7 +315,7 @@ Rcpp::List glog(const arma::mat & y,

arma::uvec uk;
for(int k = 0; k<K-1; ++k){
uk << k;
uk = { k };
subindex = arma::join_cols(subindex,arma::find(arma::abs(new_Z.col(k)) > 0.0));
}
Beta = arma::unique(subindex);
Expand Down Expand Up @@ -365,8 +363,7 @@ Rcpp::List glog(const arma::mat & y,
arma::mat grad_dic = arma::zeros<arma::mat>(p,n); // gradient dictionary for each observation
std::vector<double> llike;

arma::uvec d;
d << 1;
arma::uvec d({ 1 });
int itr=0;
do{
// Majorization-Minization step for beta (use FISTA)
Expand Down

0 comments on commit 8615ed1

Please sign in to comment.