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

Threaded version of projection to the augmentation ideal

This commit is contained in:
kalmar 2017-08-04 15:30:12 +02:00
parent 47a41ac9fe
commit 666fac1775

View File

@ -47,12 +47,13 @@ function compute_SOS(sqrt_matrix, elt)
end
function correct_to_augmentation_ideal{T<:Rational}(sqrt_matrix::Array{T,2})
sqrt_corrected = similar(sqrt_matrix)
l = size(sqrt_matrix, 2)
sqrt_corrected = copy(sqrt_matrix)
Threads.@threads for j in 1:l
col = sum(view(sqrt_matrix, :,j))//l
for i in 1:l
col = view(sqrt_matrix, :,i)
sqrt_corrected[:,i] .= col .- sum(col)//l
# @assert sum(sqrt_corrected[:,i]) == 0
sqrt_corrected[i,j] -= col
end
end
return sqrt_corrected
end