jaror, Declarative vs imperative:
let v = sum [ ((x ! i) - m) ^ 2 | i <- [0 .. cc - 1] ] / fromIntegral cc
float v = 0.0f; for (int i = 0; i < C; i++) { float xshift = x[i] - m; v += xshift * xshift; } v = v/C;
jaror, Declarative vs imperative:
let v = sum [ ((x ! i) - m) ^ 2 | i <- [0 .. cc - 1] ] / fromIntegral cc
float v = 0.0f; for (int i = 0; i < C; i++) { float xshift = x[i] - m; v += xshift * xshift; } v = v/C;
Add comment