Ask Your Question
0

How to rearrange matrix entries from another matrix entries [closed]

asked 2023-12-11 10:10:11 +0100

Akhilesh gravatar image

updated 2023-12-11 12:59:26 +0100

Suppose i have $m\times m$ matrix $D$ which is known, i have to re arrange entries of $D$ to a new $m\times m$ matrix $M$ such that $M_{i,j}=D_{j-i%m, -i%m}$. How to do it in SageMath?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Akhilesh
close date 2023-12-14 06:23:18.215781

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-12-11 14:03:32 +0100

rburing gravatar image
sage: D = matrix(QQ, 2, [[1, 2], [3, 4]]); D
[1 2]
[3 4]
sage: m = D.nrows()
sage: M = matrix(QQ, m, lambda i, j: D[(j-i)%m, (-i)%m]); M
[1 3]
[4 2]
edit flag offensive delete link more

Comments

It worked. Thanks for the help

Akhilesh gravatar imageAkhilesh ( 2023-12-12 04:44:12 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2023-12-11 10:10:11 +0100

Seen: 357 times

Last updated: Dec 11 '23