diff --git a/birch.py b/birch.py index b3ec33b..b842541 100644 --- a/birch.py +++ b/birch.py @@ -93,6 +93,7 @@ def d0(self,other): def d2(self,other): # print "\n\nself%s %s\nn: %i other n: %i" % (hash(self), self, self.n,other.n) + # i really can't understand what the '%' here means, can you explain that, thanks. return (other.n * self.squared + self.n * other.squared - 2 * (self.ls % other.ls)) / (self.n * other.n) def d4(self,other): @@ -528,7 +529,7 @@ def length(self): @property def squared(self): if not self._squared: - self._squared = self % self + self._squared = self.__mod__(self, self) # maybe here needs dot production return self._squared def distance(self,other): @@ -602,4 +603,4 @@ def distance(self,other): time = datetime.now()-start # Stop measuring the computing time print "took %s (%.2fms per point)" % (time,(time.seconds*1000+time.microseconds/1000.0)/totalpoints) - print "splitcount: %s, nodecount: %s, entrycount: %s, leafcount: %s" % (splitcount, nodecount, entrycount, leafcount) \ No newline at end of file + print "splitcount: %s, nodecount: %s, entrycount: %s, leafcount: %s" % (splitcount, nodecount, entrycount, leafcount)