let pearson (a1:float array) (a2:float array) =
let a1avg,a2avg = (mean a1),(mean a2) in
let a1sd,a2sd = (stdv a1),(stdv a2) in
let a1,a2 = (Array.to_list a1), (Array.to_list a2) in
let f acc e1 e2 =
(((e1 -. a1avg) /. a1sd) *. ((e2 -. a2avg) /. a2sd)) +. acc
in
(List.fold2_exn ~f ~init:0. a1 a2) /. (Float.of_int ((List.length a1) - 1))