From dba02c87ac39075efb86a8858fb586e0a15ea319 Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 14 Mar 2017 16:40:35 +0100 Subject: [PATCH] compute SOS now is @parallel --- src/checksolution.jl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/checksolution.jl b/src/checksolution.jl index a97c9a1..30009ee 100644 --- a/src/checksolution.jl +++ b/src/checksolution.jl @@ -6,7 +6,7 @@ function EOI{T<:Number}(Δ::GroupAlgebraElement{T}, κ::T) return Δ*Δ - κ*Δ end -function square_as_elt(vector, elt) +function algebra_square(vector, elt) zzz = zeros(elt.coefficients) zzz[1:length(vector)] = vector # new_base_elt = GroupAlgebraElement(zzz, elt.product_matrix) @@ -14,16 +14,20 @@ function square_as_elt(vector, elt) return GroupAlgebras.algebra_multiplication(zzz, zzz, elt.product_matrix) end -function compute_SOS{T<:Number}(sqrt_matrix::Array{T,2}, - elt::GroupAlgebraElement{T}) +function compute_SOS(sqrt_matrix, elt) n = size(sqrt_matrix,2) - result = zeros(T, length(elt.coefficients)) - p = Progress(n, 1, "Checking SOS decomposition...", 50) - for i in 1:n - result .+= square_as_elt(sqrt_matrix[:,i], elt) - next!(p) + T = eltype(sqrt_matrix) + + # result = zeros(T, length(elt.coefficients)) + # for i in 1:n + # result += algebra_square(sqrt_matrix[:,i], elt) + # end + + result = @parallel (+) for i in 1:n + PropertyT.algebra_square(sqrt_matrix[:,i], elt) end - return GroupAlgebraElement{T}(result, elt.product_matrix) + + return GroupAlgebraElement(result, elt.product_matrix) end function correct_to_augmentation_ideal{T<:Rational}(sqrt_matrix::Array{T,2})