INNER CODE UNIT · C++

tmp

GreenleafLab/chromVAR · src/utils.cpp:29

  arma::uvec tmp = arma::linspace<arma::uvec>(0, X.n_cols - 1, X.n_cols);
  arma::uvec ix = RcppArmadillo::sample(tmp, X.n_cols, true);
  arma::mat shuffled = X.cols(ix);
  return row_sds(shuffled, na_rm); 
 }
 
 //adapted from RcppArmadillo sample function
 //Method for sampling WITH REPLACEMENT with large vector of probabilities
 // [[Rcpp::export]]
 arma::urowvec ProbSampleReplace(int size, arma::vec prob){
   int nOrig = prob.size();
   arma::urowvec index(size);
   double rU;
   int ii, jj, kk; // indices, ii for loops
   // index tables, fill with zeros
   arma::vec HL_dat(nOrig);
   arma::vec alias_tab(nOrig); 
   arma::vec::iterator H, L, H0, L0;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…