diff --git a/groups/Allgroups.jl b/groups/Allgroups.jl index bef8fa0..1ca7957 100644 --- a/groups/Allgroups.jl +++ b/groups/Allgroups.jl @@ -4,6 +4,7 @@ using PropertyT using AbstractAlgebra using Nemo using Groups +using GroupRings export PropertyTGroup, SymmetrizedGroup, GAPGroup, SpecialLinearGroup, @@ -50,5 +51,6 @@ end include("mappingclassgroup.jl") include("higman.jl") include("caprace.jl") +include("actions.jl") end # of module PropertyTGroups diff --git a/groups/actions.jl b/groups/actions.jl new file mode 100644 index 0000000..3f7ef21 --- /dev/null +++ b/groups/actions.jl @@ -0,0 +1,92 @@ +function (p::perm)(A::GroupRingElem) + RG = parent(A) + result = zero(RG, eltype(A.coeffs)) + + for (idx, c) in enumerate(A.coeffs) + if c!= zero(eltype(A.coeffs)) + result[p(RG.basis[idx])] = c + end + end + return result +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 + +############################################################################### +# +# Action of WreathProductElems on AutGroupElem +# +############################################################################### + +function AutFG_emb(A::AutGroup, g::WreathProductElem) + isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") + parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A") + elt = A() + Id = parent(g.n.elts[1])() + flips = Groups.AutSymbol[Groups.flip_autsymbol(i) for i in 1:length(g.p.d) if g.n.elts[i] != Id] + Groups.r_multiply!(elt, flips, reduced=false) + Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)]) + return elt +end + +function AutFG_emb(A::AutGroup, p::perm) + isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") + parent(p).n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(p)) into $A") + return A(Groups.perm_autsymbol(p)) +end + +function (g::WreathProductElem)(a::Groups.Automorphism) + A = parent(a) + g = AutFG_emb(A,g) + res = A() + Groups.r_multiply!(res, g.symbols, reduced=false) + Groups.r_multiply!(res, a.symbols, reduced=false) + Groups.r_multiply!(res, [inv(s) for s in reverse!(g.symbols)]) + return res +end + +function (p::perm)(a::Groups.Automorphism) + g = AutFG_emb(parent(a),p) + return g*a*inv(g) +end diff --git a/groups/autfreegroup.jl b/groups/autfreegroup.jl index 2ebc398..6822c8b 100644 --- a/groups/autfreegroup.jl +++ b/groups/autfreegroup.jl @@ -19,41 +19,3 @@ end function autS(G::SpecialAutomorphismGroup{N}) where N return WreathProduct(PermutationGroup(2), PermutationGroup(N)) end - -############################################################################### -# -# Action of WreathProductElems on AutGroupElem -# -############################################################################### - -function AutFG_emb(A::AutGroup, g::WreathProductElem) - isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") - parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A") - elt = A() - Id = parent(g.n.elts[1])() - flips = Groups.AutSymbol[Groups.flip_autsymbol(i) for i in 1:length(g.p.d) if g.n.elts[i] != Id] - Groups.r_multiply!(elt, flips, reduced=false) - Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)]) - return elt -end - -function AutFG_emb(A::AutGroup, p::perm) - isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") - parent(p).n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A") - return A(Groups.perm_autsymbol(p)) -end - -function (g::WreathProductElem)(a::Groups.Automorphism) - A = parent(a) - g = AutFG_emb(A,g) - res = A() - Groups.r_multiply!(res, g.symbols, reduced=false) - Groups.r_multiply!(res, a.symbols, reduced=false) - Groups.r_multiply!(res, [inv(s) for s in reverse!(g.symbols)]) - return res -end - -function (p::perm)(a::Groups.Automorphism) - g = AutFG_emb(parent(a),p) - return g*a*inv(g) -end diff --git a/groups/speciallinear.jl b/groups/speciallinear.jl index aa94391..97ad9c0 100644 --- a/groups/speciallinear.jl +++ b/groups/speciallinear.jl @@ -60,46 +60,3 @@ end function autS(G::SpecialLinearGroup{N}) where N return WreathProduct(PermutationGroup(2), PermutationGroup(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