def subMatrix(self, slice1, slice2): return linear.Matrix([row[slice2] for row in self[slice1]])
def transpose(matrix): return linear.Matrix( [matrix.getCol(i) for i in range(matrix.colNum())])
def minor(self, row, col): return linear.Matrix( [[self[j][i] for i in range(self.colNum()) if i != col] for j in range(self.rowNum()) if j != row])
def cofactor(matrix): return linear.Matrix([[(-1)**(i + j) * matrix.minor(j, i).det() for i in range(matrix.colNum())] for j in range(matrix.rowNum())])
def elem(size): return linear.Matrix([[1 if col == row else 0 for col in range(size)] for row in range(size)])