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

Method __eq__

linear-algebra-python/src/lib.py:386–399  ·  view source on GitHub ↗

returns true if the matrices are equal otherwise false.

(self, other)

Source from the content-addressed store, hash-verified

384 raise Exception("matrix must have the same dimension!")
385
386 def __eq__(self, other):
387 """
388 returns true if the matrices are equal otherwise false.
389 """
390 ans = True
391 if self.__width == other.width() and self.__height == other.height():
392 for i in range(self.__height):
393 for j in range(self.__width):
394 if self.__matrix[i][j] != other.component(i, j):
395 ans = False
396 break
397 else:
398 ans = False
399 return ans
400
401
402def squareZeroMatrix(N):

Callers

nothing calls this directly

Calls 3

widthMethod · 0.80
heightMethod · 0.80
componentMethod · 0.45

Tested by

no test coverage detected