From 9585ecb1c87a4018b5cb5fa09273b4ca0d75bd05 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Mon, 5 Sep 2022 21:02:13 +0200 Subject: [PATCH] Updating RcppArmadillo initialization 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 --- src/DcSbm.cpp | 6 ++---- src/DcSbmUndirected.cpp | 6 ++---- src/MultSbm.cpp | 6 ++---- src/MultSbmUndirected.cpp | 8 +++----- src/Sbm.cpp | 6 ++---- src/SbmUndirected.cpp | 8 +++----- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/DcSbm.cpp b/src/DcSbm.cpp index e385354..a024635 100644 --- a/src/DcSbm.cpp +++ b/src/DcSbm.cpp @@ -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(old_stats["counts"]); arma::mat old_x_counts =as(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{ diff --git a/src/DcSbmUndirected.cpp b/src/DcSbmUndirected.cpp index 97ea469..5d63b06 100644 --- a/src/DcSbmUndirected.cpp +++ b/src/DcSbmUndirected.cpp @@ -87,10 +87,8 @@ double DcSbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const arma::vec old_counts =as(old_stats["counts"]); arma::mat old_x_counts =as(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{ diff --git a/src/MultSbm.cpp b/src/MultSbm.cpp index adb9c79..52de52a 100644 --- a/src/MultSbm.cpp +++ b/src/MultSbm.cpp @@ -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(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{ diff --git a/src/MultSbmUndirected.cpp b/src/MultSbmUndirected.cpp index 56ecdb9..4fd48ba 100644 --- a/src/MultSbmUndirected.cpp +++ b/src/MultSbmUndirected.cpp @@ -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(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{ @@ -130,4 +128,4 @@ double MultSbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,con } return icl_cor; -} \ No newline at end of file +} diff --git a/src/Sbm.cpp b/src/Sbm.cpp index 8aaddb4..d16e0fb 100644 --- a/src/Sbm.cpp +++ b/src/Sbm.cpp @@ -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(old_stats["counts"]); arma::mat old_x_counts =as(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{ diff --git a/src/SbmUndirected.cpp b/src/SbmUndirected.cpp index 7afbe6e..df4fc2f 100644 --- a/src/SbmUndirected.cpp +++ b/src/SbmUndirected.cpp @@ -59,10 +59,8 @@ double SbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const L arma::vec old_counts =as(old_stats["counts"]); arma::mat old_x_counts =as(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{ @@ -117,4 +115,4 @@ double SbmUndirected::delta_merge_correction(int k,int l,int obk,int obl,const L return icl_cor; -} \ No newline at end of file +}