(self, other: Matrix)
| 296 | return self * -1 |
| 297 | |
| 298 | def __add__(self, other: Matrix) -> Matrix: |
| 299 | if self.order != other.order: |
| 300 | raise ValueError("Addition requires matrices of the same order") |
| 301 | return Matrix( |
| 302 | [ |
| 303 | [self.rows[i][j] + other.rows[i][j] for j in range(self.num_columns)] |
| 304 | for i in range(self.num_rows) |
| 305 | ] |
| 306 | ) |
| 307 | |
| 308 | def __sub__(self, other: Matrix) -> Matrix: |
| 309 | if self.order != other.order: |