Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

G-circulant matrices

asked 3 years ago

tungnt gravatar image

updated 3 years ago

Dear the community,

I wonder whether there is a built-in library/function for G-circulant matrices in SAGE? Here G is a group and a matrix A is called G-circulant if A has the form A=(aτ1σ)τ,σG. Please see [1] for further details.

When G=Z/n, SAGE has a built-in library/function. Namely, given a vector v of length n, we can generate a circulant matrix with the first row equal to v using the following code

matrix.circulant(v)

Thank you for your help!

[1] Kanemitsu, Shigeru, and Michel Waldschmidt. "Matrices of finite abelian groups, finite Fourier transform and codes, Proc. 6th China-Japan Sem. Number Theory, World Sci. London-Singapore-New Jersey (2013): 90-106.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
4

answered 3 years ago

rburing gravatar image

updated 3 years ago

They don't seem to be built-in, but such a matrix can be constructed with one line of code:

def group_matrix(G, v):
    """
    Return the G-circulant matrix associated with the vector v.

    INPUT:

    - ``G`` -- a list (i.e. an ordered list) of elements which form a finite group
    - ``v`` -- a vector with exactly ``len(G)`` entries
    """
    return matrix(v.base_ring(), len(G), lambda i,j: v[G.index(G[i].inverse()*G[j])])

Example 1:

sage: S = SymmetricGroup(3)
sage: G = S.subgroup([S("(2,3,1)")])
sage: X = vector(PolynomialRing(QQ, 3, names='x').gens())
sage: group_matrix(list(G), X)
[x0 x1 x2]
[x2 x0 x1]
[x1 x2 x0]

Example 2:

sage: Y = vector(PolynomialRing(QQ, 6, names='y').gens())
sage: group_matrix(list(S), Y)
[y0 y1 y2 y3 y4 y5]
[y2 y0 y1 y4 y5 y3]
[y1 y2 y0 y5 y3 y4]
[y3 y4 y5 y0 y1 y2]
[y4 y5 y3 y2 y0 y1]
[y5 y3 y4 y1 y2 y0]

Example 3:

sage: v = vector(ZZ, [0,1,2])
sage: group_matrix(list(G), v)
[0 1 2]
[2 0 1]
[1 2 0]
Preview: (hide)
link

Comments

Thank you so much for your help. This is really awesome.

I have a follow-up question: for the problems that I am working on, I need to specify the values of the xi variables. When I tried

X=[0,1,1] (meaning that x0=0, x1=1, x2=-1), there is the following error

AttributeError: 'list' object has no attribute 'base_ring'

I guess I don't quite understand the meaning of the code "v.base_ring()". For me, the base_ring=Z is good enough (I can use the syntax to change the base ring to Fp later).

Thank you!

tungnt gravatar imagetungnt ( 3 years ago )
1

You're welcome! The function assumes that the input v is a vector, so that its base ring can be used as the base ring of the matrix. To clarify, I've added an example with concrete values instead of variables.

rburing gravatar imagerburing ( 3 years ago )
1

Everything makes sense (and works now!) Thank you very much!

tungnt gravatar imagetungnt ( 3 years ago )

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: 3 years ago

Seen: 829 times

Last updated: Jan 12 '22