2017-06-22 14:12:35 +02:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# Orbit stuff
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2018-07-31 10:21:54 +02:00
|
|
|
function orbit_decomposition(G::Group, E::Vector, rdict=GroupRings.reverse_dict(E))
|
2017-06-22 14:12:35 +02:00
|
|
|
|
|
|
|
elts = collect(elements(G))
|
|
|
|
|
|
|
|
tovisit = trues(E);
|
|
|
|
orbits = Vector{Vector{Int}}()
|
|
|
|
|
2018-03-22 10:52:53 +01:00
|
|
|
orbit = zeros(Int, length(elts))
|
|
|
|
|
2017-06-22 14:12:35 +02:00
|
|
|
for i in 1:endof(E)
|
|
|
|
if tovisit[i]
|
2018-03-22 10:52:53 +01:00
|
|
|
g = E[i]
|
|
|
|
Threads.@threads for j in 1:length(elts)
|
|
|
|
orbit[j] = rdict[elts[j](g)]
|
2017-06-22 14:12:35 +02:00
|
|
|
end
|
2017-08-27 18:32:19 +02:00
|
|
|
tovisit[orbit] = false
|
2017-06-22 14:12:35 +02:00
|
|
|
push!(orbits, unique(orbit))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return orbits
|
|
|
|
end
|
|
|
|
|
|
|
|
function orbit_spvector(vect::AbstractVector, orbits)
|
|
|
|
orb_vector = spzeros(length(orbits))
|
|
|
|
|
|
|
|
for (i,o) in enumerate(orbits)
|
|
|
|
k = vect[collect(o)]
|
|
|
|
val = k[1]
|
|
|
|
@assert all(k .== val)
|
|
|
|
orb_vector[i] = val
|
|
|
|
end
|
|
|
|
|
|
|
|
return orb_vector
|
|
|
|
end
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
2018-09-05 10:39:24 +02:00
|
|
|
# perm-, matrix-, representations
|
2017-06-22 14:12:35 +02:00
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2017-11-08 09:28:04 +01:00
|
|
|
function perm_repr(g::GroupElem, E::Vector, E_dict)
|
2018-01-01 14:06:33 +01:00
|
|
|
p = Vector{Int}(length(E))
|
|
|
|
for (i,elt) in enumerate(E)
|
|
|
|
p[i] = E_dict[g(elt)]
|
|
|
|
end
|
|
|
|
return p
|
2017-08-27 18:35:35 +02:00
|
|
|
end
|
|
|
|
|
2017-11-08 09:28:04 +01:00
|
|
|
function perm_reps(G::Group, E::Vector, E_rdict=GroupRings.reverse_dict(E))
|
2018-01-01 14:06:33 +01:00
|
|
|
elts = collect(elements(G))
|
|
|
|
l = length(elts)
|
2018-07-31 10:21:54 +02:00
|
|
|
preps = Vector{perm}(l)
|
2017-08-27 18:35:35 +02:00
|
|
|
|
2018-07-31 10:21:54 +02:00
|
|
|
permG = PermutationGroup(length(E))
|
2017-08-27 18:35:35 +02:00
|
|
|
|
2018-01-01 14:06:33 +01:00
|
|
|
Threads.@threads for i in 1:l
|
2018-08-08 19:38:44 +02:00
|
|
|
preps[i] = permG(PropertyT.perm_repr(elts[i], E, E_rdict), false)
|
2018-01-01 14:06:33 +01:00
|
|
|
end
|
2017-08-27 18:35:35 +02:00
|
|
|
|
2018-01-01 14:06:33 +01:00
|
|
|
return Dict(elts[i]=>preps[i] for i in 1:l)
|
2017-08-27 18:35:35 +02:00
|
|
|
end
|
|
|
|
|
2018-09-05 10:39:24 +02:00
|
|
|
function matrix_repr(x::GroupRingElem, mreps::Dict)
|
2018-08-20 04:02:44 +02:00
|
|
|
nzeros = findn(x.coeffs)
|
|
|
|
return sum(x[i].*mreps[parent(x).basis[i]] for i in nzeros)
|
2017-06-22 14:12:35 +02:00
|
|
|
end
|
|
|
|
|
2018-09-05 10:39:24 +02:00
|
|
|
function matrix_reps(preps::Dict{T,perm{I}}) where {T<:GroupElem, I<:Integer}
|
|
|
|
kk = collect(keys(preps))
|
|
|
|
mreps = Vector{SparseMatrixCSC{Float64, Int}}(length(kk))
|
|
|
|
Threads.@threads for i in 1:length(kk)
|
|
|
|
mreps[i] = AbstractAlgebra.matrix_repr(preps[kk[i]])
|
|
|
|
end
|
|
|
|
return Dict(kk[i] => mreps[i] for i in 1:length(kk))
|
2017-06-22 14:12:35 +02:00
|
|
|
end
|