I have:
(def data [[1 3 4 7 9] [7 6 3 2 7] [1 9 8 6 2]])
I want to average these (element-wise to get):
[3 6 5 5 6]
Like you would in MATLAB:
mean([1 3 4 7 9; 7 6 3 2 7; 1 9 8 6 2])
With Incanter I can do:
(map #(/ % (count m)) (apply plus data))
If data is rather large (and I have lots of them) is there a better way to do this?
Does it help to calculate the (count m)
beforehand?
Does it help to defn
the #(/ % (count m))
beforehand?