mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 02:15:29 +01:00
allow arbitrary actions in orbit_decomposition (defaults to ^)
This commit is contained in:
parent
c467a52f83
commit
6ab18d0283
@ -58,9 +58,14 @@ function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
|
|||||||
return fact.U[:,1:M_rank]
|
return fact.U[:,1:M_rank]
|
||||||
end
|
end
|
||||||
|
|
||||||
orbit_decomposition(G::Group, E::AbstractVector, rdict=GroupRings.reverse_dict(E)) = orbit_decomposition(collect(G), E, rdict)
|
orbit_decomposition(
|
||||||
|
G::Group,
|
||||||
|
E::AbstractVector,
|
||||||
|
rdict = GroupRings.reverse_dict(E);
|
||||||
|
op = ^,
|
||||||
|
) = orbit_decomposition(collect(G), E, rdict; op=op)
|
||||||
|
|
||||||
function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVector, rdict=GroupRings.reverse_dict(E))
|
function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVector, rdict=GroupRings.reverse_dict(E); op=^)
|
||||||
|
|
||||||
tovisit = trues(size(E));
|
tovisit = trues(size(E));
|
||||||
orbits = Vector{Vector{Int}}()
|
orbits = Vector{Vector{Int}}()
|
||||||
@ -71,7 +76,7 @@ function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVecto
|
|||||||
if tovisit[i]
|
if tovisit[i]
|
||||||
g = E[i]
|
g = E[i]
|
||||||
Threads.@threads for j in eachindex(elts)
|
Threads.@threads for j in eachindex(elts)
|
||||||
orbit[j] = rdict[elts[j](g)]
|
orbit[j] = rdict[op(g, elts[j])]
|
||||||
end
|
end
|
||||||
tovisit[orbit] .= false
|
tovisit[orbit] .= false
|
||||||
push!(orbits, unique(orbit))
|
push!(orbits, unique(orbit))
|
||||||
@ -139,7 +144,7 @@ end
|
|||||||
function perm_repr(g::GroupElem, E::Vector, E_dict)
|
function perm_repr(g::GroupElem, E::Vector, E_dict)
|
||||||
p = Vector{Int}(undef, length(E))
|
p = Vector{Int}(undef, length(E))
|
||||||
for (i,elt) in enumerate(E)
|
for (i,elt) in enumerate(E)
|
||||||
p[i] = E_dict[g(elt)]
|
p[i] = E_dict[elt^g]
|
||||||
end
|
end
|
||||||
return p
|
return p
|
||||||
end
|
end
|
||||||
@ -178,29 +183,33 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function (g::GroupRingElem)(y::GroupRingElem)
|
function Base.:^(y::GroupRingElem, g::GroupRingElem, op = ^)
|
||||||
res = parent(y)()
|
res = parent(y)()
|
||||||
for elt in GroupRings.supp(g)
|
for elt in GroupRings.supp(g)
|
||||||
res += g[elt]*elt(y)
|
res += g[elt] * ^(y, elt, op)
|
||||||
end
|
end
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
function (g::GroupElem)(y::GroupRingElem)
|
function Base.:^(y::GroupRingElem, g::GroupElem, op = ^)
|
||||||
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 !iszero(c)
|
if !iszero(c)
|
||||||
result[g(RG.basis[idx])] = c
|
result[op(RG.basis[idx], g)] = c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function (g::GroupElem)(y::GroupRingElem{T, <:SparseVector}) where T
|
function Base.:^(
|
||||||
|
y::GroupRingElem{T,<:SparseVector},
|
||||||
|
g::GroupElem,
|
||||||
|
op = ^,
|
||||||
|
) 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[op(RG.basis[idx], g)] for idx in y.coeffs.nzind]
|
||||||
|
|
||||||
result = GroupRingElem(sparsevec(index, y.coeffs.nzval, y.coeffs.n), RG)
|
result = GroupRingElem(sparsevec(index, y.coeffs.nzval, y.coeffs.n), RG)
|
||||||
|
|
||||||
@ -213,28 +222,29 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function (p::Generic.Perm)(A::MatAlgElem)
|
function Base.:^(A::MatAlgElem, p::Generic.Perm)
|
||||||
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)
|
||||||
@inbounds for i in 1:size(A, 1)
|
@inbounds for i = 1:size(A, 1)
|
||||||
for j in 1:size(A, 2)
|
for j = 1:size(A, 2)
|
||||||
result[p[i], p[j]] = A[i,j] # action by permuting rows and colums/conjugation
|
result[p[i], p[j]] = A[i, j] # action by permuting rows and colums/conjugation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function (g::WreathProductElem{N})(A::MatAlgElem) where N
|
function Base.:^(A::MatAlgElem, g::WreathProductElem{N}) 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)
|
||||||
result = similar(A)
|
result = similar(A)
|
||||||
R = base_ring(parent(A))
|
R = base_ring(parent(A))
|
||||||
tmp = R(1)
|
tmp = R(1)
|
||||||
|
|
||||||
@inbounds for i = 1:size(A,1)
|
@inbounds for i = 1:size(A, 1)
|
||||||
for j = 1:size(A,2)
|
for j = 1:size(A, 2)
|
||||||
x = A[i, j]
|
x = A[i, j]
|
||||||
if flips[i]*flips[j] == 1
|
if flips[i] * flips[j] == 1
|
||||||
result[g.p[i], g.p[j]] = x
|
result[g.p[i], g.p[j]] = x
|
||||||
else
|
else
|
||||||
result[g.p[i], g.p[j]] = -x
|
result[g.p[i], g.p[j]] = -x
|
||||||
@ -250,7 +260,7 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function (g::GroupElem)(a::Automorphism)
|
function Base.:^(a::Automorphism, g::GroupElem)
|
||||||
Ag = parent(a)(g)
|
Ag = parent(a)(g)
|
||||||
Ag_inv = inv(Ag)
|
Ag_inv = inv(Ag)
|
||||||
res = append!(Ag, a, Ag_inv)
|
res = append!(Ag, a, Ag_inv)
|
||||||
@ -261,10 +271,11 @@ end
|
|||||||
|
|
||||||
function (A::AutGroup)(g::WreathProductElem)
|
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]))
|
||||||
for i in 1:length(g.p.d)
|
for i = 1:length(g.p.d)
|
||||||
if g.n.elts[i] != Id
|
if g.n.elts[i] != Id
|
||||||
push!(elt, Groups.flip(i))
|
push!(elt, Groups.flip(i))
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@ function Sq(RG::GroupRing, N::Integer)
|
|||||||
|
|
||||||
sq = RG()
|
sq = RG()
|
||||||
for σ in Alt_N
|
for σ in Alt_N
|
||||||
GroupRings.addeq!(sq, *(σ(Δ₂), σ(Δ₂), false))
|
GroupRings.addeq!(sq, *(Δ₂^σ, Δ₂^σ, false))
|
||||||
end
|
end
|
||||||
return sq÷factorial(N-2)
|
return sq÷factorial(N-2)
|
||||||
end
|
end
|
||||||
@ -30,7 +30,7 @@ function Adj(RG::GroupRing, N::Integer)
|
|||||||
Δ₂ = length(S₂)*one(RG, ℤ) - RG(S₂, ℤ);
|
Δ₂ = length(S₂)*one(RG, ℤ) - RG(S₂, ℤ);
|
||||||
|
|
||||||
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
|
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
|
||||||
Δ₂s = Dict(σ=>σ(Δ₂) for σ in Alt_N)
|
Δ₂s = Dict(σ=>Δ₂^σ for σ in Alt_N)
|
||||||
adj = RG()
|
adj = RG()
|
||||||
|
|
||||||
for σ in Alt_N
|
for σ in Alt_N
|
||||||
@ -52,7 +52,7 @@ function Op(RG::GroupRing, N::Integer)
|
|||||||
Δ₂ = length(S₂)*one(RG, ℤ) - RG(S₂, ℤ);
|
Δ₂ = length(S₂)*one(RG, ℤ) - RG(S₂, ℤ);
|
||||||
|
|
||||||
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
|
Alt_N = [g for g in SymmetricGroup(N) if parity(g) == 0]
|
||||||
Δ₂s = Dict(σ=>σ(Δ₂) for σ in Alt_N)
|
Δ₂s = Dict(σ=>Δ₂^σ for σ in Alt_N)
|
||||||
op = RG()
|
op = RG()
|
||||||
|
|
||||||
for σ in Alt_N
|
for σ in Alt_N
|
||||||
|
Loading…
Reference in New Issue
Block a user