1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-27 01:10:28 +01:00

Threaded version of reconstruct_sol

This commit is contained in:
kalmar 2017-08-03 11:35:34 +02:00
parent a460b71db9
commit 47a41ac9fe

View File

@ -115,20 +115,21 @@ function matrix_reps{T<:GroupElem}(G::Group, S::Vector{T}, AutS::Group, radius::
end end
function reconstruct_sol{T<:GroupElem, S<:AbstractArray}(mreps::Dict{T, S}, function reconstruct_sol{T<:GroupElem, S<:AbstractArray}(mreps::Dict{T, S},
Us::Vector, Ps::Vector, dims::Vector) Us::Vector, Ps::Vector, dims::Vector)
n = size(Us[1],1) s = size(first(mreps).second)
recP = zeros(Float64, (n,n)) recP = zeros(Float64, s)
Ust = transpose.(Us) tmp = [zeros(Float64, s) for _ in 1:length(Us)]
for g in keys(mreps) ks = [(g, inv(g)) for g in keys(mreps)]
A, B = mreps[g], mreps[inv(g)]
for π in 1:length(Us) Threads.@threads for π in 1:length(Us)
recP .+= dims[π].* (A * Us[π]*Ps[π]*Ust[π] * B) for (g, invg) in ks
end tmp[π] += dims[π]*mreps[g]*Us[π]*Ps[π]*Us[π]'*mreps[invg]
end end
recP .*= 1/length(keys(mreps)) end
recP[abs.(recP) .< eps(eltype(recP))] = zero(eltype(recP)) recP += 1/length(keys(mreps)) .* sum(tmp)
return recP recP[abs.(recP) .< eps(eltype(recP))] = zero(eltype(recP))
return recP
end end
function Cstar_repr{T}(x::GroupRingElem{T}, mreps::Dict) function Cstar_repr{T}(x::GroupRingElem{T}, mreps::Dict)