A = [
[a1_1, a1_2, ..., a1_W],
[a2_1, a2_2, ..., a2_W],
: : : :
[aH_1, aH_2, ..., aH_W]
]
Matrix A like the one above
At = [
[a1_1, a2_1, ..., aH_1],
[a1_2, a2_2, ..., aH_2],
: : : :
[a1_W, a2_W, ..., aH_W]
]
It refers to a matrix transformed like At above.
displace.py
A = [
[1, 2],
[3, 4],
[5, 6]
]
H = 3
W = 2
At = [[A[i][j] for i in range(H)] for j in range(W)]
print(*A, sep="\n")
print("")
print(*At, sep="\n")
> displace.py
[1, 2]
[3, 4]
[5, 6]
[1, 3, 5]
[2, 4, 6]
success.
Recommended Posts