GroupsWithPropertyT/groups/speciallinear.jl

115 lines
2.6 KiB
Julia

struct SpecialLinearGroup <: SymmetrizedGroup
args::Dict{String,Any}
group::AbstractAlgebra.Group
N::Int
function SpecialLinearGroup(args::Dict)
n = args["SL"]
p = args["p"]
X = args["X"]
if p == 0
G = MatrixSpace(Nemo.ZZ, n, n)
else
R = Nemo.NmodRing(UInt(p))
G = MatrixSpace(R, n, n)
end
return new(args, G, n)
end
end
function name(G::SpecialLinearGroup)
p = G.args["p"]
X = G.args["X"]
if p == 0
R = (X ? "Z[x]" : "Z")
else
R = "F$p"
end
if G.args["nosymmetry"]
return "SL($(G.N),$R)"
else
return "oSL($(G.N),$R)"
end
end
group(G::SpecialLinearGroup) = G.group
function E(i::Int, j::Int, M::MatSpace, val=one(M.base_ring))
@assert i≠j
m = one(M)
m[i,j] = val
return m
end
function generatingset(G::SpecialLinearGroup)
p = G.args["p"]
X = G.args["X"]
p > 0 && X && throw("SL(n, F_p[x]) not implemented")
SL = group(G)
r = G.args["radius"]
return generatingset(SL, r, X)
end
function generatingset(SL::MatSpace, radius::Integer, X::Bool=false)
n = SL.cols
indexing = [(i,j) for i in 1:n for j in 1:n if i≠j]
if !X
S = [E(idx[1],idx[2],SL) for idx in indexing]
else
S = [E(i,j,SL,v) for (i,j) in indexing for v in [1, 100*r]]
end
return unique([S; inv.(S)])
end
function autS(G::SpecialLinearGroup)
return WreathProduct(PermutationGroup(2), PermutationGroup(G.N))
end
###############################################################################
#
# Action of WreathProductElems on Nemo.MatElem
#
###############################################################################
function matrix_emb(n::DirectProductGroupElem, p::perm)
Id = parent(n.elts[1])()
elt = diagm([(-1)^(el == Id ? 0 : 1) for el in n.elts])
return elt[:, p.d]
end
function (g::WreathProductElem)(A::MatElem)
g_inv = inv(g)
G = matrix_emb(g.n, g_inv.p)
G_inv = matrix_emb(g_inv.n, g.p)
M = parent(A)
return M(G)*A*M(G_inv)
end
import Base.*
doc"""
*(x::AbstractAlgebra.MatElem, P::Generic.perm)
> Apply the pemutation $P$ to the rows of the matrix $x$ and return the result.
"""
function *(x::AbstractAlgebra.MatElem, P::Generic.perm)
z = similar(x)
m = rows(x)
n = cols(x)
for i = 1:m
for j = 1:n
z[i, j] = x[i,P[j]]
end
end
return z
end
function (p::perm)(A::MatElem)
length(p.d) == A.r == A.c || throw("Can't act via $p on matrix of size ($(A.r), $(A.c))")
return p*A*inv(p)
end