Skip to content

Commit

Permalink
Updating RcppArmadillo initialization
Browse files Browse the repository at this point in the history
These six two-line 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 5, 2022
1 parent 5567110 commit 9585ecb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
6 changes: 2 additions & 4 deletions src/DcSbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,8 @@ double DcSbm::delta_merge_correction(int k,int l,int obk,int obl,const List & ol
arma::vec old_counts =as<arma::vec>(old_stats["counts"]);
arma::mat old_x_counts =as<arma::mat>(old_stats["x_counts"]);
cc = counts(k)*counts(l);
arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({ obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down
6 changes: 2 additions & 4 deletions src/DcSbmUndirected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ double DcSbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const
arma::vec old_counts =as<arma::vec>(old_stats["counts"]);
arma::mat old_x_counts =as<arma::mat>(old_stats["x_counts"]);
cc = counts(k)*counts(l);
arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down
6 changes: 2 additions & 4 deletions src/MultSbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,8 @@ double MultSbm::delta_merge_correction(int k,int l,int obk,int obl,const List &
arma::cube old_x_counts =as<arma::cube>(old_stats["x_counts"]);
arma::vec klcounts;

arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down
8 changes: 3 additions & 5 deletions src/MultSbmUndirected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ double MultSbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,con
double oxc,xc;
arma::cube old_x_counts =as<arma::cube>(old_stats["x_counts"]);
arma::vec klcounts;
arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down Expand Up @@ -130,4 +128,4 @@ double MultSbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,con
}

return icl_cor;
}
}
6 changes: 2 additions & 4 deletions src/Sbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ double Sbm::delta_merge_correction(int k,int l,int obk,int obl,const List & old_
arma::vec old_counts =as<arma::vec>(old_stats["counts"]);
arma::mat old_x_counts =as<arma::mat>(old_stats["x_counts"]);
cc = counts(k)*counts(l);
arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down
8 changes: 3 additions & 5 deletions src/SbmUndirected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ double SbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const L
arma::vec old_counts =as<arma::vec>(old_stats["counts"]);
arma::mat old_x_counts =as<arma::mat>(old_stats["x_counts"]);
cc = counts(k)*counts(l);
arma::uvec kl;
kl << k << l << arma::endr;
arma::uvec mkl;
mkl << obk << obl << arma::endr;
arma::uvec kl({k, l});
arma::uvec mkl({obk, obl});
if(l>=obk){
lo=l+1;
}else{
Expand Down Expand Up @@ -117,4 +115,4 @@ double SbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const L
return icl_cor;


}
}

0 comments on commit 9585ecb

Please sign in to comment.