`colSums(i) / m` can be pre-computed. The corner case `n <= 1` should be handled somewhere.