Skip to content

Commit

Permalink
replace std::random_shuffle() with std::shuffle()
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbiederstedt committed Apr 15, 2023
1 parent ea42bc4 commit 2095e82
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
32 changes: 13 additions & 19 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Package: scde
Type: Package
Title: Single Cell Differential Expression
Version: 2.26.2
Date: 2016-01-20
Version: 2.27.1
Description: The scde package implements a set of statistical methods for
analyzing single-cell RNA-seq data. scde fits individual error models for
single-cell RNA-seq measurements. These models can then be used for assessment
Expand All @@ -18,16 +17,17 @@ Description: The scde package implements a set of statistical methods for
transcriptional heterogeneity through pathway and gene set overdispersion
analysis" (Fan J, Salathia N, Liu R, Kaeser G, Yung Y, Herman J, Kaper F,
Fan JB, Zhang K, Chun J, and Kharchenko PV, Nature Methods, doi:10.1038/nmeth.3734).
Author: Peter Kharchenko [aut, cre],
Jean Fan [aut]
Author: Peter Kharchenko [aut, cre], Jean Fan [aut], Evan Biederstedt [aut]
Authors@R: c(
person("Peter", "Kharchenko", role = c("aut", "cre"),
email = "Peter_Kharchenko@hms.harvard.edu"),
email = "Peter_Kharchenko@hms.harvard.edu"),
person("Jean", "Fan", role = "aut",
email = "jeanfan@jhu.edu",
comment = c(ORCID = "0000-0002-0212-5451"))
)
Maintainer: Jean Fan <jeanfan@jhu.edu>
email = "jeanfan@jhu.edu",
comment = c(ORCID = "0000-0002-0212-5451")),
person("Evan", "Biederstedt", role = "aut",
email = "evan.biederstedt@gmail.com")
)
Maintainer: Evan Biederstedt <evan.biederstedt@gmail.com>
URL: http://pklab.med.harvard.edu/scde
BugReports: https://github.com/hms-dbmi/scde/issues
License: GPL-2
Expand All @@ -36,17 +36,11 @@ Depends: R (>= 3.0.0), flexmix
Imports: Rcpp (>= 0.10.4), RcppArmadillo (>= 0.5.400.2.0), mgcv, Rook,
rjson, MASS, Cairo, RColorBrewer, edgeR, quantreg, methods,
nnet, RMTstat, extRemes, pcaMethods, BiocParallel, parallel
Suggests: knitr, cba, fastcluster, WGCNA, GO.db, org.Hs.eg.db,
rmarkdown
biocViews: ImmunoOncology, RNASeq, StatisticalMethod,
DifferentialExpression, Bayesian, Transcription, Software
Suggests: knitr, cba, fastcluster, WGCNA, GO.db, org.Hs.eg.db, rmarkdown
biocViews: ImmunoOncology, RNASeq, StatisticalMethod, DifferentialExpression, Bayesian,
Transcription, Software
LinkingTo: Rcpp, RcppArmadillo
VignetteBuilder: knitr
Packaged: 2023-01-19 22:55:25 UTC; biocbuild
Packaged: 2015-11-02 14:30:04 UTC; reyes
RoxygenNote: 5.0.0
NeedsCompilation: yes
git_url: https://git.bioconductor.org/packages/scde
git_branch: RELEASE_3_16
git_last_commit: 42cdc08
git_last_commit_date: 2023-01-19
Date/Publication: 2023-01-19
6 changes: 2 additions & 4 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)


PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lm `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
7 changes: 2 additions & 5 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@

## This assume that we can call Rscript to ask Rcpp about its locations
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = $(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS=-L/usr/lib/ -L"." -lpthread -lm $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
11 changes: 9 additions & 2 deletions src/bwpca.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "bwpca.h"
#include <random>
#include <vector>
#include <algorithm>
#include <iostream>
Expand All @@ -24,8 +25,11 @@ void set_random_matrix(arma::mat& target,arma::mat& source) {
ind[j]=j;
} // set up initial index (1,2,3)

// The random number generator that we want to use (Mersenne Twister)
std::mt19937 rng(std::time(nullptr));

for(int i=0;i<target.n_cols;i++) {
std::random_shuffle(ind.begin(), ind.end());
std::shuffle(ind.begin(), ind.end(), rng); // NOTE: std::random_shuffler() was deprecated in C++14 and completely removed in C++17
//std::sort(ind.start(), ind.end(), std::bind(compare_on_other, _1, _2, rv));
for(int j=0;j<target.n_rows;j++) {
target(j,i)=source(ind[j],i);
Expand All @@ -41,8 +45,11 @@ void set_random_matrices(arma::mat& target1,arma::mat& source1,arma::mat& target
ind[j]=j;
} // set up initial index (1,2,3)

// The random number generator that we want to use (Mersenne Twister)
std::mt19937 rng(std::time(nullptr));

for(int i=0;i<target1.n_cols;i++) {
std::random_shuffle(ind.begin(), ind.end());
std::shuffle(ind.begin(), ind.end(), rng); // NOTE: std::random_shuffler() was deprecated in C++14 and completely removed in C++17
//std::sort(ind.start(), ind.end(), std::bind(compare_on_other, _1, _2, rv));
for(int j=0;j<target1.n_rows;j++) {
target1(j,i)=source1(ind[j],i);
Expand Down

0 comments on commit 2095e82

Please sign in to comment.