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

compute SOS now is @parallel

This commit is contained in:
kalmar 2017-03-14 16:40:35 +01:00
parent 9ab11e295e
commit dba02c87ac

View File

@ -6,7 +6,7 @@ function EOI{T<:Number}(Δ::GroupAlgebraElement{T}, κ::T)
return Δ*Δ - κ*Δ return Δ*Δ - κ*Δ
end end
function square_as_elt(vector, elt) function algebra_square(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)
@ -14,16 +14,20 @@ function square_as_elt(vector, elt)
return GroupAlgebras.algebra_multiplication(zzz, zzz, elt.product_matrix) return GroupAlgebras.algebra_multiplication(zzz, zzz, elt.product_matrix)
end end
function compute_SOS{T<:Number}(sqrt_matrix::Array{T,2}, function compute_SOS(sqrt_matrix, elt)
elt::GroupAlgebraElement{T})
n = size(sqrt_matrix,2) n = size(sqrt_matrix,2)
result = zeros(T, length(elt.coefficients)) T = eltype(sqrt_matrix)
p = Progress(n, 1, "Checking SOS decomposition...", 50)
for i in 1:n # result = zeros(T, length(elt.coefficients))
result .+= square_as_elt(sqrt_matrix[:,i], elt) # for i in 1:n
next!(p) # result += algebra_square(sqrt_matrix[:,i], elt)
# end
result = @parallel (+) for i in 1:n
PropertyT.algebra_square(sqrt_matrix[:,i], elt)
end end
return GroupAlgebraElement{T}(result, elt.product_matrix)
return GroupAlgebraElement(result, elt.product_matrix)
end end
function correct_to_augmentation_ideal{T<:Rational}(sqrt_matrix::Array{T,2}) function correct_to_augmentation_ideal{T<:Rational}(sqrt_matrix::Array{T,2})