37 """Equality test mixin using sum-square-differences."""
39 def __eq__(self, other):
40 return self.ssd(other) == 0
42 def __ne__(self, other):
43 return self.ssd(other) != 0
45 def isclose(self, other, rel_tol=1e-09, abs_tol=0.0):
46 """Returns true if object is close to other."""
52 return d <= max(rel_tol * max(na, nb), abs_tol)
56 """Copy Elements mixin."""
59 """Copy elements from src to self"""
68 """Copy elements from self to dst"""
78 """Mixin for compatibility division operator."""
79 def __div__(self, other):
80 return self.__truediv__(other)
83 """Divide self by a scalar"""
84 return self.__itruediv__(other)
88 """Mixin for vector-like objects."""
90 def __radd__(self, other):
95 """Mixin for matrix-like objects."""
96 def _str_helper(self, name, m=None, n=None):
103 newrow =
",\n%s[" % spaces
104 for i
in range(0, m):
109 for j
in range(0, n):
111 s +=
"%f" % self[i, j]
113 s +=
", %f" % self[i, j]
def copy_from(self, src)
Copy elements from src to self.
def copy_to(self, dst)
Copy elements from self to dst.
Mixin for compatibility division operator.
def __idiv__(self, other)
Divide self by a scala.
Mixin for matrix-like objects.
def isclose(self, other, rel_tol=1e-09, abs_tol=0.0)
Returns true if object is close to other.
Mixin for vector-like objects.