Return self^T. Example: >>> a = Matrix(2, 3) >>> for r in range(2): ... for c in range(3): ... a[r,c] = r*c ... >>> a.transpose() Matrix consist of 3 rows and 2 columns
(self)
| 178 | raise TypeError(msg) |
| 179 | |
| 180 | def transpose(self) -> Matrix: |
| 181 | """ |
| 182 | <method Matrix.transpose> |
| 183 | Return self^T. |
| 184 | Example: |
| 185 | >>> a = Matrix(2, 3) |
| 186 | >>> for r in range(2): |
| 187 | ... for c in range(3): |
| 188 | ... a[r,c] = r*c |
| 189 | ... |
| 190 | >>> a.transpose() |
| 191 | Matrix consist of 3 rows and 2 columns |
| 192 | [0, 0] |
| 193 | [0, 1] |
| 194 | [0, 2] |
| 195 | """ |
| 196 | |
| 197 | result = Matrix(self.column, self.row) |
| 198 | for r in range(self.row): |
| 199 | for c in range(self.column): |
| 200 | result[c, r] = self[r, c] |
| 201 | return result |
| 202 | |
| 203 | def sherman_morrison(self, u: Matrix, v: Matrix) -> Any: |
| 204 | """ |