MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / transpose

Method transpose

matrix/sherman_morrison.py:180–201  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 10

test1Function · 0.95
sum_of_square_errorFunction · 0.80
mfccFunction · 0.80
calculate_fftFunction · 0.80
circular_convolutionMethod · 0.80
show_resultsFunction · 0.80
sherman_morrisonMethod · 0.80
test_transposeFunction · 0.80

Calls 1

MatrixClass · 0.70

Tested by 1

test_transposeFunction · 0.64