mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-14 14:15:28 +01:00
rework group actions
This commit is contained in:
parent
b9a30f02c7
commit
0778f828e4
@ -186,25 +186,19 @@ function (g::GroupRingElem)(y::GroupRingElem)
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
###############################################################################
|
function (g::GroupElem)(y::GroupRingElem)
|
||||||
#
|
|
||||||
# perm actions
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
function (g::Generic.Perm)(y::GroupRingElem)
|
|
||||||
RG = parent(y)
|
RG = parent(y)
|
||||||
result = zero(RG, eltype(y.coeffs))
|
result = zero(RG, eltype(y.coeffs))
|
||||||
|
|
||||||
for (idx, c) in enumerate(y.coeffs)
|
for (idx, c) in enumerate(y.coeffs)
|
||||||
if c!= zero(eltype(y.coeffs))
|
if !iszero(c)
|
||||||
result[g(RG.basis[idx])] = c
|
result[g(RG.basis[idx])] = c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function (g::Generic.Perm)(y::GroupRingElem{T, <:SparseVector}) where T
|
function (g::GroupElem)(y::GroupRingElem{T, <:SparseVector}) where T
|
||||||
RG = parent(y)
|
RG = parent(y)
|
||||||
index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind]
|
index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind]
|
||||||
|
|
||||||
@ -213,6 +207,12 @@ function (g::Generic.Perm)(y::GroupRingElem{T, <:SparseVector}) where T
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# perm && WreathProductElems actions: MatAlgElem
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function (p::Generic.Perm)(A::MatAlgElem)
|
function (p::Generic.Perm)(A::MatAlgElem)
|
||||||
length(p.d) == size(A, 1) == size(A,2) || throw("Can't act via $p on matrix of size $(size(A))")
|
length(p.d) == size(A, 1) == size(A,2) || throw("Can't act via $p on matrix of size $(size(A))")
|
||||||
result = similar(A)
|
result = similar(A)
|
||||||
@ -224,24 +224,6 @@ function (p::Generic.Perm)(A::MatAlgElem)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# WreathProductElems action on MatAlgElem
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
function (g::WreathProductElem)(y::GroupRingElem)
|
|
||||||
RG = parent(y)
|
|
||||||
result = zero(RG, eltype(y.coeffs))
|
|
||||||
|
|
||||||
for (idx, c) in enumerate(y.coeffs)
|
|
||||||
if c!= zero(eltype(y.coeffs))
|
|
||||||
result[g(RG.basis[idx])] = c
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
function (g::WreathProductElem{N})(A::MatAlgElem) where N
|
function (g::WreathProductElem{N})(A::MatAlgElem) where N
|
||||||
# @assert N == size(A,1) == size(A,2)
|
# @assert N == size(A,1) == size(A,2)
|
||||||
flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N)
|
flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N)
|
||||||
@ -257,8 +239,6 @@ function (g::WreathProductElem{N})(A::MatAlgElem) where N
|
|||||||
else
|
else
|
||||||
result[g.p[i], g.p[j]] = -x
|
result[g.p[i], g.p[j]] = -x
|
||||||
end
|
end
|
||||||
# result[i, j] = AbstractAlgebra.mul!(x, x, flips[i]*flips[j])
|
|
||||||
# this mul! needs to be separately defined, but is 2x faster
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
@ -266,33 +246,33 @@ end
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Action of WreathProductElems on AutGroupElem
|
# perm && WreathProductElems actions: Automorphism
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function AutFG_emb(A::AutGroup, g::WreathProductElem)
|
function (g::GroupElem)(a::Automorphism)
|
||||||
|
Ag = parent(a)(g)
|
||||||
|
Ag_inv = inv(Ag)
|
||||||
|
res = append!(Ag, a, Ag_inv)
|
||||||
|
return Groups.freereduce!(res)
|
||||||
|
end
|
||||||
|
|
||||||
|
(A::AutGroup)(p::Generic.Perm) = A(Groups.AutSymbol(p))
|
||||||
|
|
||||||
|
function (A::AutGroup)(g::WreathProductElem)
|
||||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
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")
|
parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
|
||||||
elt = one(A)
|
elt = one(A)
|
||||||
Id = one(parent(g.n.elts[1]))
|
Id = one(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]
|
for i in 1:length(g.p.d)
|
||||||
Groups.r_multiply!(elt, flips, reduced=false)
|
if g.n.elts[i] != Id
|
||||||
Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)])
|
push!(elt, Groups.flip(i))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
push!(elt, Groups.AutSymbol(g.p))
|
||||||
return elt
|
return elt
|
||||||
end
|
end
|
||||||
|
|
||||||
function (g::WreathProductElem)(a::Groups.Automorphism)
|
|
||||||
A = parent(a)
|
|
||||||
g_emb = AutFG_emb(A,g)
|
|
||||||
res = deepcopy(g_emb)
|
|
||||||
res = Groups.r_multiply!(res, a.symbols, reduced=false)
|
|
||||||
res = Groups.r_multiply!(res, [inv(s) for s in reverse!(g_emb.symbols)])
|
|
||||||
return res
|
|
||||||
end
|
|
||||||
|
|
||||||
function (p::Generic.Perm)(a::Groups.Automorphism)
|
# fallback:
|
||||||
res = parent(a)(Groups.perm_autsymbol(p))
|
Base.one(p::Generic.Perm) = Perm(length(p.d))
|
||||||
res = Groups.r_multiply!(res, a.symbols, reduced=false)
|
|
||||||
res = Groups.r_multiply!(res, [Groups.perm_autsymbol(inv(p))])
|
|
||||||
return res
|
|
||||||
end
|
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
ssgs(M::MatAlgebra, i, j) = (S = [Eij(M, i, j), Eij(M, j, i)];
|
ssgs(M::MatAlgebra, i, j) = (S = [Eij(M, i, j), Eij(M, j, i)];
|
||||||
S = unique([S; inv.(S)]); S)
|
S = unique([S; inv.(S)]); S)
|
||||||
|
|
||||||
rmul = Groups.rmul_autsymbol
|
|
||||||
lmul = Groups.lmul_autsymbol
|
|
||||||
|
|
||||||
function ssgs(A::AutGroup, i, j)
|
function ssgs(A::AutGroup, i, j)
|
||||||
rmuls = [rmul(i,j), rmul(j,i)]
|
rmuls = [Groups.transvection_R(i,j), Groups.transvection_R(j,i)]
|
||||||
lmuls = [lmul(i,j), lmul(j,i)]
|
lmuls = [Groups.transvection_L(i,j), Groups.transvection_L(j,i)]
|
||||||
gen_set = A.([rmuls; lmuls])
|
gen_set = A.([rmuls; lmuls])
|
||||||
return unique([gen_set; inv.(gen_set)])
|
return unique([gen_set; inv.(gen_set)])
|
||||||
end
|
end
|
||||||
@ -33,7 +30,7 @@
|
|||||||
elt2 = E_R[rand(sizes[1]:sizes[2])]
|
elt2 = E_R[rand(sizes[1]:sizes[2])]
|
||||||
y = 2RG(elt2) - RG(elt)
|
y = 2RG(elt2) - RG(elt)
|
||||||
|
|
||||||
for G in [PermGroup(N), WreathProduct(PermGroup(2), PermGroup(N))]
|
for G in [SymmetricGroup(N), WreathProduct(SymmetricGroup(2), SymmetricGroup(N))]
|
||||||
@test all(g(one(M)) == one(M) for g in G)
|
@test all(g(one(M)) == one(M) for g in G)
|
||||||
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
|
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
|
||||||
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
|
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
|
||||||
@ -50,9 +47,9 @@
|
|||||||
Sij = ssgs(M, i,j)
|
Sij = ssgs(M, i,j)
|
||||||
Δij= PropertyT.spLaplacian(RG, Sij)
|
Δij= PropertyT.spLaplacian(RG, Sij)
|
||||||
|
|
||||||
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in PermGroup(N))
|
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
|
||||||
|
|
||||||
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(PermGroup(2), PermGroup(N)))
|
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -79,7 +76,7 @@ end
|
|||||||
elt2 = E_R[rand(sizes[1]:sizes[2])]
|
elt2 = E_R[rand(sizes[1]:sizes[2])]
|
||||||
y = 2RG(elt2) - RG(elt)
|
y = 2RG(elt2) - RG(elt)
|
||||||
|
|
||||||
for G in [PermGroup(N), WreathProduct(PermGroup(2), PermGroup(N))]
|
for G in [SymmetricGroup(N), WreathProduct(SymmetricGroup(2), SymmetricGroup(N))]
|
||||||
@test all(g(one(M)) == one(M) for g in G)
|
@test all(g(one(M)) == one(M) for g in G)
|
||||||
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
|
@test all(rdict[g(m)] <= sizes[1] for g in G for m in S)
|
||||||
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
|
@test all(g(m)*g(n) == g(m*n) for g in G for m in S for n in S)
|
||||||
@ -95,9 +92,9 @@ end
|
|||||||
Sij = ssgs(M, i,j)
|
Sij = ssgs(M, i,j)
|
||||||
Δij= PropertyT.spLaplacian(RG, Sij)
|
Δij= PropertyT.spLaplacian(RG, Sij)
|
||||||
|
|
||||||
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in PermGroup(N))
|
@test all(p(Δij) == PropertyT.spLaplacian(RG, ssgs(M, p[i], p[j])) for p in SymmetricGroup(N))
|
||||||
|
|
||||||
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(PermGroup(2), PermGroup(N)))
|
@test all(g(Δij) == PropertyT.spLaplacian(RG, ssgs(M, g.p[i], g.p[j])) for g in WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user