module Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance
def weighted_euclidean_distance_to(other, weights = [ 1.0 ] * values.size)
def weighted_euclidean_distance_to(other, weights = [ 1.0 ] * values.size) sum = 0.0 values.zip(other.values, weights) do |s, o, w| sum += w * (s - o) ** 2 end Math.sqrt(sum) end