compute_sum_var_diff function

Compute weighted sum of var_diff