implements the matrix-subtraction.
(self,other)
| 288 | else: |
| 289 | raise Exception("matrix must have the same dimension!") |
| 290 | def __sub__(self,other): |
| 291 | """ |
| 292 | implements the matrix-subtraction. |
| 293 | """ |
| 294 | if (self.__width == other.width() and self.__height == other.height()): |
| 295 | matrix = [] |
| 296 | for i in range(self.__height): |
| 297 | row = [] |
| 298 | for j in range(self.__width): |
| 299 | row.append(self.__matrix[i][j] - other.component(i,j)) |
| 300 | matrix.append(row) |
| 301 | return Matrix(matrix,self.__width,self.__height) |
| 302 | else: |
| 303 | raise Exception("matrix must have the same dimension!") |
| 304 | |
| 305 | |
| 306 | def squareZeroMatrix(N): |