Commit f8f630f0 authored by Taddeus Kroes's avatar Taddeus Kroes

Removed use of get_bin_index function for efficiency reasons.

parent df98d883
......@@ -6,12 +6,14 @@ class Histogram:
self.max = max
def add(self, number):
bin_index = self.get_bin_index(number)
self.bins[bin_index] += 1
#bin_index = self.get_bin_index(number)
#self.bins[bin_index] += 1
self.bins[number] += 1
def remove(self, number):
bin_index = self.get_bin_index(number)
self.bins[bin_index] -= 1
#bin_index = self.get_bin_index(number)
#self.bins[bin_index] -= 1
self.bins[number] -= 1
def get_bin_index(self, number):
return (number - self.min) / ((self.max - self.min) / len(self.bins))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment