returns true if the matrices are equal otherwise false.
(self, other)
| 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 | |
| 402 | def squareZeroMatrix(N): |