# Revision history [back]

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]


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]