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

replace parallel by Progress meter

This commit is contained in:
kalmar 2017-03-13 11:24:43 +01:00
parent a828ab4254
commit f373be8a5b

View File

@ -2,6 +2,7 @@ using JuMP
import Base: rationalize import Base: rationalize
using GroupAlgebras using GroupAlgebras
using ProgressMeter
function create_product_matrix(basis, limit) function create_product_matrix(basis, limit)
product_matrix = zeros(Int, (limit,limit)) product_matrix = zeros(Int, (limit,limit))
@ -89,7 +90,7 @@ function EOI{T<:Number}(Δ::GroupAlgebraElement{T}, κ::T)
return Δ*Δ - κ*Δ return Δ*Δ - κ*Δ
end end
@everywhere function square_as_elt(vector, elt) function square_as_elt(vector, elt)
zzz = zeros(elt.coefficients) zzz = zeros(elt.coefficients)
zzz[1:length(vector)] = vector zzz[1:length(vector)] = vector
# new_base_elt = GroupAlgebraElement(zzz, elt.product_matrix) # new_base_elt = GroupAlgebraElement(zzz, elt.product_matrix)
@ -100,9 +101,11 @@ end
function compute_SOS{T<:Number}(sqrt_matrix::Array{T,2}, function compute_SOS{T<:Number}(sqrt_matrix::Array{T,2},
elt::GroupAlgebraElement{T}) elt::GroupAlgebraElement{T})
n = size(sqrt_matrix,2) n = size(sqrt_matrix,2)
# result = zeros(T, length(elt.coefficients)) result = zeros(T, length(elt.coefficients))
result = @parallel (+) for i in 1:n p = Progress(n, 1, "Checking SOS decomposition...", 50)
square_as_elt(sqrt_matrix[:,i], elt) for i in 1:n
result .+= square_as_elt(sqrt_matrix[:,i], elt)
next!(p)
end end
return GroupAlgebraElement{T}(result, elt.product_matrix) return GroupAlgebraElement{T}(result, elt.product_matrix)
end end