1

I have a 2-dim matrix, and I would like to truncate all elements less than some threshold to 0. It would be simple to realize in base R with code X[X < 0.1] <- 0. But how can I realize it efficiently in Rcpp with Eigen3 if X is of type MatrixXd. Thanks!

Aileen LI
  • 11
  • 1
  • 2
    This seems relevant / duplicate: https://stackoverflow.com/questions/40445701/replacing-all-negative-elements-with-zero-eigen3-c – user20650 Jun 19 '20 at 13:55

0 Answers0