mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-30 10:00:28 +01:00
replace rationalise&project with interval&project
This commit is contained in:
parent
0225f38066
commit
96ce02852f
@ -48,16 +48,6 @@ function compute_SOS(Q::AbstractArray, pm::Array{Int,2}, l::Int)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function correct_to_augmentation_ideal{T<:Rational}(sqrt_matrix::Array{T,2})
|
|
||||||
l = size(sqrt_matrix, 2)
|
|
||||||
sqrt_corrected = Array{Interval{Float64}}(l,l)
|
|
||||||
Threads.@threads for j in 1:l
|
|
||||||
col = sum(view(sqrt_matrix, :,j))//l
|
|
||||||
for i in 1:l
|
|
||||||
sqrt_corrected[i,j] = (Float64(sqrt_matrix[i,j]) - Float64(col)) ± eps(0.0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return sqrt_corrected
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function distance_to_cone{S<:Interval}(elt::GroupRingElem, Q::AbstractArray{S,2}, wlen::Int)
|
function distance_to_cone{S<:Interval}(elt::GroupRingElem, Q::AbstractArray{S,2}, wlen::Int)
|
||||||
@ -88,17 +78,21 @@ function distance_to_cone{T}(elt::GroupRingElem, Q::AbstractArray{T,2}, wlen::In
|
|||||||
return dist
|
return dist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function augIdproj{T, I<:AbstractInterval}(S::Type{I}, Q::AbstractArray{T,2})
|
||||||
|
l = size(Q, 2)
|
||||||
|
R = zeros(Interval, (l,l))
|
||||||
|
Threads.@threads for j in 1:l
|
||||||
|
col = sum(view(Q, :,j))/l
|
||||||
|
for i in 1:l
|
||||||
|
R[i,j] = Q[i,j] - col ± eps(0.0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return R
|
||||||
end
|
end
|
||||||
|
|
||||||
function rationalize_and_project{T}(Q::AbstractArray{T}, δ::T, logger)
|
function augIdproj{T}(Q::AbstractArray{T,2}, logger)
|
||||||
info(logger, "")
|
info(logger, "Projecting columns of Q to the augmentation ideal...")
|
||||||
info(logger, "Rationalizing with accuracy $δ")
|
@logtime logger Q = augIdproj(Interval, Q)
|
||||||
t = @timed Q = ℚ(Q, δ)
|
|
||||||
info(logger, timed_msg(t))
|
|
||||||
|
|
||||||
info(logger, "Projecting columns of the rationalized Q to the augmentation ideal...")
|
|
||||||
t = @timed Q = correct_to_augmentation_ideal(Q)
|
|
||||||
info(logger, timed_msg(t))
|
|
||||||
|
|
||||||
info(logger, "Checking that sum of every column contains 0.0... ")
|
info(logger, "Checking that sum of every column contains 0.0... ")
|
||||||
check = all([0.0 in sum(view(Q, :, i)) for i in 1:size(Q, 2)])
|
check = all([0.0 in sum(view(Q, :, i)) for i in 1:size(Q, 2)])
|
||||||
|
Loading…
Reference in New Issue
Block a user