SHOW:
|
|
- or go back to the newest paste.
| 1 | import numpy as np | |
| 2 | ||
| 3 | - | def macierz(n,m): |
| 3 | + | #------------------------------------ |
| 4 | - | A = np.random.randint(0,10,(m,n)) |
| 4 | + | |
| 5 | def macierz_transponowana(A): | |
| 6 | ||
| 7 | - | print A |
| 7 | + | m, n = A.shape |
| 8 | ||
| 9 | B = np.empty([n,m], dtype=int) | |
| 10 | ||
| 11 | for i in range(0,n): | |
| 12 | for j in range(0,m): | |
| 13 | - | print B |
| 13 | + | |
| 14 | ||
| 15 | - | A=A.transpose() |
| 15 | + | return B |
| 16 | - | return A |
| 16 | + | |
| 17 | - | macierz(5,8) |
| 17 | + | #------------------------------------ |
| 18 | ||
| 19 | m = np.random.randint(1,10) | |
| 20 | n = np.random.randint(1,10) | |
| 21 | ||
| 22 | X = np.random.randint(0,10,(m,n)) | |
| 23 | ||
| 24 | print X | |
| 25 | ||
| 26 | Y = macierz_transponowana(X) | |
| 27 | ||
| 28 | print Y |