MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / __eq__

Method __eq__

linear_algebra/src/lib.py:98–106  ·  view source on GitHub ↗

performs the comparison between two vectors

(self, other: object)

Source from the content-addressed store, hash-verified

96 raise Exception("must have the same size")
97
98 def __eq__(self, other: object) -> bool:
99 """
100 performs the comparison between two vectors
101 """
102 if not isinstance(other, Vector):
103 return NotImplemented
104 if len(self) != len(other):
105 return False
106 return all(self.component(i) == other.component(i) for i in range(len(self)))
107
108 @overload
109 def __mul__(self, other: float) -> Vector: ...

Callers

nothing calls this directly

Calls 1

componentMethod · 0.95

Tested by

no test coverage detected