1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 16:20: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 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})
sqrt_corrected = similar(sqrt_matrix) l = size(sqrt_matrix, 2)
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 for i in 1:l
col = view(sqrt_matrix, :,i) sqrt_corrected[i,j] -= col
sqrt_corrected[:,i] .= col .- sum(col)//l end
# @assert sum(sqrt_corrected[:,i]) == 0
end end
return sqrt_corrected return sqrt_corrected
end end