# NOT RUN {
# which_min_nm is typically much faster than
# which(x == min(x), arr.ind = TRUE)
x <- matrix(rnorm(100), ncol = 10)
all(which(x == min(x), arr.ind = TRUE) == which_min_nm(x))
benchmark(which(x == min(x), arr.ind = TRUE), which_min_nm(x),
replications = 5000)
# }
Run the code above in your browser using DataLab