Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One can define: ( r denotes the first row)

def negacyclic(r):
    a=list(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]

One can define: ( r denotes the first row)

def negacyclic(r):
    a=list(reversed(list(r[1:])))
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]