1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15:29 +01:00

group matrix-,perm-reps in one place

This commit is contained in:
kalmarek 2018-09-05 10:39:24 +02:00
parent 36fbaa5393
commit fc0a9ccfec

View File

@ -41,24 +41,10 @@ end
###############################################################################
#
# Matrix-, Permutation- and C*-representations
# perm-, matrix-, representations
#
###############################################################################
function matrix_repr(p::perm)
N = parent(p).n
return sparse(1:N, p.d, [1.0 for _ in 1:N])
end
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] = matrix_repr(preps[kk[i]])
end
return Dict(kk[i] => mreps[i] for i in 1:length(kk))
end
function perm_repr(g::GroupElem, E::Vector, E_dict)
p = Vector{Int}(length(E))
for (i,elt) in enumerate(E)
@ -81,12 +67,7 @@ function perm_reps(G::Group, E::Vector, E_rdict=GroupRings.reverse_dict(E))
return Dict(elts[i]=>preps[i] for i in 1:l)
end
function perm_reps(S::Vector, autS::Group, radius::Int)
E, _ = Groups.generate_balls(S, radius=radius)
return perm_reps(autS, E)
end
function Cstar_repr(x::GroupRingElem{T}, mreps::Dict) where {T}
function matrix_repr(x::GroupRingElem, mreps::Dict)
nzeros = findn(x.coeffs)
return sum(x[i].*mreps[parent(x).basis[i]] for i in nzeros)
end
@ -98,4 +79,11 @@ function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
return fact[:U][:,1:M_rank]
end
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))
end