Fix euclidean distance function to remove num_variables dependency.