mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-27 01:10:28 +01:00
len -> wlen is no longer a kwarg, and has no default value
This commit is contained in:
parent
aae4ee57c7
commit
d98d68004b
@ -192,7 +192,7 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
||||
info(logger, "minimum(P) = $(minimum(P))")
|
||||
|
||||
if λ > 0
|
||||
sgap = check_distance_to_positive_cone(Δ, λ, P, tol=tol, rational=false, len=2*radius)
|
||||
sgap = check_distance_to_positive_cone(Δ, λ, P, 2*radius, tol=tol, rational=false)
|
||||
if isa(sgap, Interval)
|
||||
sgap = sgap.lo
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ end
|
||||
|
||||
ℚ(x, tol::Real) = rationalize(BigInt, x, tol=tol)
|
||||
|
||||
function distance_to_cone{T<:Rational}(λ::T, sqrt_matrix::Array{T,2}, Δ::GroupRingElem{T}; len=4)
|
||||
function distance_to_cone{T<:Rational}(λ::T, sqrt_matrix::Array{T,2}, Δ::GroupRingElem{T}, wlen)
|
||||
SOS = compute_SOS(sqrt_matrix, Δ)
|
||||
|
||||
SOS_diff = EOI(Δ, λ) - SOS
|
||||
@ -73,11 +73,11 @@ function distance_to_cone{T<:Rational}(λ::T, sqrt_matrix::Array{T,2}, Δ::Group
|
||||
info(logger, "ɛ(Δ² - λΔ - ∑ξᵢ*ξᵢ) = $ɛ_dist")
|
||||
info(logger, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ = $(@sprintf("%.10f", float(eoi_SOS_L1_dist)))")
|
||||
|
||||
distance_to_cone = λ - 2^(len-1)*eoi_SOS_L1_dist
|
||||
distance_to_cone = λ - 2^(wlen-1)*eoi_SOS_L1_dist
|
||||
return distance_to_cone
|
||||
end
|
||||
|
||||
function distance_to_cone{T<:Rational, S<:Interval}(λ::T, sqrt_matrix::Array{S,2}, Δ::GroupRingElem{T}; len=4)
|
||||
function distance_to_cone{T<:Rational, S<:Interval}(λ::T, sqrt_matrix::Array{S,2}, Δ::GroupRingElem{T}, wlen)
|
||||
SOS = compute_SOS(sqrt_matrix, Δ)
|
||||
info(logger, "ɛ(∑ξᵢ*ξᵢ) ∈ $(GroupRings.augmentation(SOS))")
|
||||
λ_int = @interval(λ)
|
||||
@ -91,11 +91,11 @@ function distance_to_cone{T<:Rational, S<:Interval}(λ::T, sqrt_matrix::Array{S,
|
||||
info(logger, "ɛ(Δ² - λΔ - ∑ξᵢ*ξᵢ) ∈ $(ɛ_dist)")
|
||||
info(logger, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ∈ $(eoi_SOS_L1_dist)")
|
||||
|
||||
distance_to_cone = λ - 2^(len-1)*eoi_SOS_L1_dist
|
||||
distance_to_cone = λ - 2^(wlen-1)*eoi_SOS_L1_dist
|
||||
return distance_to_cone
|
||||
end
|
||||
|
||||
function distance_to_cone(λ, sqrt_matrix::Array, Δ::GroupRingElem; len=4)
|
||||
function distance_to_cone(λ, sqrt_matrix::Array, Δ::GroupRingElem, wlen)
|
||||
SOS = compute_SOS(sqrt_matrix, Δ)
|
||||
|
||||
SOS_diff = EOI(Δ, λ) - SOS
|
||||
@ -106,12 +106,12 @@ function distance_to_cone(λ, sqrt_matrix::Array, Δ::GroupRingElem; len=4)
|
||||
info(logger, "ɛ(Δ² - λΔ - ∑ξᵢ*ξᵢ) ≈ $(@sprintf("%.10f", ɛ_dist))")
|
||||
info(logger, "‖Δ² - λΔ - ∑ξᵢ*ξᵢ‖₁ ≈ $(@sprintf("%.10f", eoi_SOS_L1_dist))")
|
||||
|
||||
distance_to_cone = λ - 2^(len-1)*eoi_SOS_L1_dist
|
||||
distance_to_cone = λ - 2^(wlen-1)*eoi_SOS_L1_dist
|
||||
return distance_to_cone
|
||||
end
|
||||
|
||||
function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P;
|
||||
tol=1e-7, rational=false, len=4)
|
||||
function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P, wlen;
|
||||
tol=1e-7, rational=false)
|
||||
|
||||
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
|
||||
warn("The solution matrix doesn't seem to be positive definite!")
|
||||
@ -121,7 +121,7 @@ function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P;
|
||||
info(logger, "------------------------------------------------------------")
|
||||
info(logger, "")
|
||||
info(logger, "Checking in floating-point arithmetic...")
|
||||
t = @timed fp_distance = distance_to_cone(λ, Q, Δ, len=len)
|
||||
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, "------------------------------------------------------------")
|
||||
@ -141,7 +141,7 @@ function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P;
|
||||
|
||||
info(logger, "Checking in interval arithmetic")
|
||||
Q_ℚω_int = Float64.(Q_ℚω) ± δ
|
||||
t = @timed Interval_dist_to_ΣSq = distance_to_cone(λ_ℚ, Q_ℚω_int, Δ_ℚ, len=len)
|
||||
t = @timed Interval_dist_to_ΣSq = distance_to_cone(λ_ℚ, Q_ℚω_int, Δ_ℚ, wlen)
|
||||
info(logger, timed_msg(t))
|
||||
info(logger, "The Augmentation-projected actual distance (to positive cone) ∈ $(Interval_dist_to_ΣSq)")
|
||||
info(logger, "------------------------------------------------------------")
|
||||
@ -150,7 +150,7 @@ function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P;
|
||||
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_ℚω, Δ_ℚ, len=len)
|
||||
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)))")
|
||||
|
Loading…
Reference in New Issue
Block a user