let mean a =
  let n = Array.length a in
  assert (n > 0);
  (Array.fold ~f:(+.) ~init:0. a) /. (Float.of_int n)