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

check_distance_to... -> distance_to_...

and a lot of old code removal
This commit is contained in:
kalmarek 2017-10-27 18:34:07 +02:00
parent 4ae2c617cb
commit 098a7ce948

View File

@ -106,13 +106,12 @@ function augIdproj{T}(Q::AbstractArray{T,2}, logger)
return Q
end
function check_distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen;
tol=1e-14, rational=false)
function distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen::Int)
info(logger, "------------------------------------------------------------")
info(logger, "")
info(logger, "λ = ")
info(logger, "Checking in floating-point arithmetic...")
t = @timed fp_distance = distance_to_cone(λ, Q, Δ, wlen)
Δ²_λΔ = EOI(Δ, λ)
t = @timed fp_distance = λ - distance_to_cone(Δ²_λΔ, Q, wlen)
info(logger, timed_msg(t))
info(logger, "Floating point distance (to positive cone) ≈ $(@sprintf("%.10f", fp_distance))")
info(logger, "------------------------------------------------------------")
@ -122,26 +121,17 @@ function check_distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen;
end
info(logger, "")
Q_ω_int = rationalize_and_project(Q, tol, logger)
λ_ = (λ, tol)
Δ_ = (Δ, tol)
Q = augIdproj(Q, logger)
info(logger, "Checking in interval arithmetic")
λ = @interval(λ)
Δ = GroupRingElem([@interval(c) for c in Δ.coeffs], parent(Δ))
Δ²_λΔ = EOI(Δ, λ)
t = @timed Interval_dist_to_ΣSq = distance_to_cone(λ_, Q_ω_int, Δ_, wlen)
t = @timed Interval_dist_to_ΣSq = λ - distance_to_cone(Δ²_λΔ, Q, wlen)
info(logger, timed_msg(t))
info(logger, "The Augmentation-projected actual distance (to positive cone) ∈ $(Interval_dist_to_ΣSq)")
info(logger, "------------------------------------------------------------")
if Interval_dist_to_ΣSq.lo 0 || !rational
return Interval_dist_to_ΣSq
else
info(logger, "Checking Projected SOS decomposition in exact rational arithmetic...")
t = @timed _dist_to_ΣSq = distance_to_cone(λ_, Q_ω, Δ_, wlen)
info(logger, timed_msg(t))
@assert isa(_dist_to_ΣSq, Rational)
info(logger, "Augmentation-projected rational distance (to positive cone) ≥ $(Float64(trunc(_dist_to_ΣSq,8)))")
info(logger, "------------------------------------------------------------")
return _dist_to_ΣSq
end
return Interval_dist_to_ΣSq
end