1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 08:15:29 +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,14 +47,15 @@ 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)
for i in 1:l Threads.@threads for j in 1:l
col = view(sqrt_matrix, :,i) col = sum(view(sqrt_matrix, :,j))//l
sqrt_corrected[:,i] .= col .- sum(col)//l for i in 1:l
# @assert sum(sqrt_corrected[:,i]) == 0 sqrt_corrected[i,j] -= col
end end
return sqrt_corrected end
return sqrt_corrected
end end
function distance_to_cone{T<:Rational}(λ::T, sqrt_matrix::Array{T,2}, Δ::GroupRingElem{T}, wlen) function distance_to_cone{T<:Rational}(λ::T, sqrt_matrix::Array{T,2}, Δ::GroupRingElem{T}, wlen)