From fd29784a008f1324a0fbf598f6a34261aa9cfc05 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 8 Aug 2018 00:24:17 +0200 Subject: [PATCH] more efficient actions of autS --- groups/autfreegroup.jl | 19 +++++++++++-------- groups/speciallinear.jl | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/groups/autfreegroup.jl b/groups/autfreegroup.jl index c4923b9..6570d28 100644 --- a/groups/autfreegroup.jl +++ b/groups/autfreegroup.jl @@ -39,10 +39,10 @@ end 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") - Id = parent(g.n[1])() - powers = ((el == Id ? 0: 1) for el in g.n.elts) elt = A() - Groups.r_multiply!(elt, [Groups.flip_autsymbol(i, pow=p) for (i,p) in enumerate(powers)], reduced=false) + 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 @@ -54,13 +54,16 @@ function AutFG_emb(A::AutGroup, p::perm) end function (g::WreathProductElem)(a::Groups.Automorphism) - g = AutFG_emb(parent(a),g) - return g*a*g^-1 + 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*g^-1 -end - + return g*a*inv(g) end diff --git a/groups/speciallinear.jl b/groups/speciallinear.jl index 219551f..81393e4 100644 --- a/groups/speciallinear.jl +++ b/groups/speciallinear.jl @@ -71,21 +71,23 @@ end # ############################################################################### -function matrix_emb(MM::MatSpace, g::WreathProductElem) - parent(g).P.n == MM.cols == MM.rows || throw("No natural embedding of $(parent(g)) in ") - powers = [(elt == parent(elt)() ? 0: 1) for elt in g.n.elts] - elt = diagm([(-1)^(elt == parent(elt)() ? 0: 1) for elt in g.n.elts]) - return MM(elt)*MM(Nemo.matrix_repr(g.p)') +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 = matrix_emb(parent(A), g) - inv_G = matrix_emb(parent(A), inv(g)) - return G*A*inv_G + g_inv = inv(g) + G = matrix_emb(g.n, g_inv.p) + G_inv = matrix_emb(g_inv.n, g.p) + M = parent(A) + res = M(G_inv) + Nemo.mul!(res, A, res) + return Nemo.mul!(res, M(G), res) 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))") - R = parent(A) return p*A*inv(p) end