INNER CODE UNIT · C++
p
GreenleafLab/chromVAR · src/utils.cpp:90
arma::vec p = p_tmp(bin_membership ) / bin_density(bin_membership );
p /= arma::sum(p);
arma::urowvec sampled = ProbSampleReplace(niterations * ix.n_elem, p);
for (arma::uword j = 0; j < ix.n_elem; j++){
out.row(ix(j)) = sampled(arma::span(j*niterations,
((j+1)*niterations) - 1));
}
}
return out;
}
//computes euclidean distance between rows of matrix x
// [[Rcpp::export]]
arma::mat euc_dist(arma::mat x) {