slighlty more performant reconstruct_sol

This commit is contained in:
kalmarek 2018-08-20 03:55:40 +02:00
parent 5acc00a4d0
commit 66ac37a6a7
1 changed files with 6 additions and 3 deletions

View File

@ -96,8 +96,7 @@ function perm_reps(S::Vector, autS::Group, radius::Int)
return perm_reps(autS, E)
end
function reconstruct_sol{T<:GroupElem, S<:perm}(preps::Dict{T, S},
Us::Vector, Ps::Vector, dims::Vector)
function reconstruct_sol(preps::Dict{T, S}, Us::Vector, Ps::Vector, dims::Vector) where {T<:GroupElem, S<:perm}
l = length(Us)
transfP = [dims[π].*Us[π]*Ps[π]*Us[π]' for π in 1:l]
@ -111,7 +110,11 @@ function reconstruct_sol{T<:GroupElem, S<:perm}(preps::Dict{T, S},
end
recP = 1/length(perms) .* sum(tmp)
recP[abs.(recP) .< eps(eltype(recP))] = zero(eltype(recP))
for i in eachindex(recP)
if abs(recP[i]) .< eps(eltype(recP))*100
recP[i] = zero(eltype(recP))
end
end
return recP
end