Exemplo n.º 1
0
 def subMatrix(self, slice1, slice2):
     return linear.Matrix([row[slice2] for row in self[slice1]])
Exemplo n.º 2
0
 def transpose(matrix):
     return linear.Matrix(
         [matrix.getCol(i) for i in range(matrix.colNum())])
Exemplo n.º 3
0
 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])
Exemplo n.º 4
0
 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())])
Exemplo n.º 5
0
def elem(size):
    return linear.Matrix([[1 if col == row else 0 for col in range(size)]
                          for row in range(size)])