fastest way to get Min from every column in a matrix?

前端 未结 6 2082
执念已碎
执念已碎 2020-12-16 16:13

What is the fastest way to extract the min from each column in a matrix?


EDIT:

Moved all the benchmarks to the answer below.

Using

6条回答
  •  眼角桃花
    2020-12-16 17:08

    mat[(1:ncol(mat)-1)*nrow(mat)+max.col(t(-mat))] seems pretty fast, and it's base R.

提交回复
热议问题