Ask Your Question
0

Is there a function for negacyclic matrices?

asked 2023-03-04 04:42:38 +0100

sgmth gravatar image

I know that circulant matrices are defined in sagemath. I don't know if negacyclic matrices are defined in sagemath. If not, then how to construct them?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-03-04 08:01:43 +0100

achrzesz gravatar image

updated 2023-03-04 08:03:07 +0100

One can define: ( r denotes the first row)

def negacyclic(r):
    a=reversed(list(r[1:]))
    c=[r[0]]+list(-vector(a))
    return matrix.toeplitz(c,r[1:])

r=var('x',n=5) 
negacyclic(r)

[ x0  x1  x2  x3  x4]
[-x4  x0  x1  x2  x3]
[-x3 -x4  x0  x1  x2]
[-x2 -x3 -x4  x0  x1]
[-x1 -x2 -x3 -x4  x0]

r=[1..5]
negacyclic(r)

[ 1  2  3  4  5]
[-5  1  2  3  4]
[-4 -5  1  2  3]
[-3 -4 -5  1  2]
[-2 -3 -4 -5  1]
edit flag offensive delete link more

Comments

Oh Great !. Thanks a lot

sgmth gravatar imagesgmth ( 2023-03-04 14:13:52 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-03-04 04:42:38 +0100

Seen: 185 times

Last updated: Mar 04 '23