diff -r 6e1f6c9cd4ac -r 49b7545d94ab src/python/m5/stats/info.py --- a/src/python/m5/stats/info.py Tue Jan 29 10:28:27 2013 +0000 +++ b/src/python/m5/stats/info.py Tue Jan 29 10:31:49 2013 +0000 @@ -946,22 +946,48 @@ def __nonzero__(self): return any(self.value) - ## @brief Not implemented. + ## @brief Determine if two Vector2ds are equal by comparing the values. + # Compares the values on a per-element basis. + # @return True if non equal, False otherwise. def __eq__(self, other): - return True + if isinstance(self.value, (list, tuple)) and \ + isinstance(other.value, (list, tuple)): + return all(map(lambda x, y : x == y, self.value, other.value)) + else: + return False - ## @brief Not implemented. + ## @brief Subtract one Vector2d from another on a per element basis. + # @param other The other Dist. def __isub__(self, other): + if isinstance(self.value, (list, tuple)) and \ + isinstance(other.value, (list, tuple)): + for sd,od in zip(self.value, other.value): + sd -= od + else: + self.value -= other.value return self - ## @brief Not implemented. + ## @brief Add one Vector2d to another on a per element basis. + # @param other The other Dist. def __iadd__(self, other): + if isinstance(self.value, (list, tuple)) and \ + isinstance(other.value, (list, tuple)): + for sd,od in zip(self.value, other.value): + sd += od + else: + self.value += other.value return self - ## @brief Not implemented. + ## @brief Divide one Vector2d by a scalar. + # @param other The other value. def __itruediv__(self, other): if not other: return self + if isinstance(self.value, (list, tuple)): + for val in self.value: + val /= other + else: + self.value /= other return self __all__ = [ 'unproxy', 'scalar', 'vector', 'value', 'values', 'total', 'len',