1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 18:25:30 +01:00
This commit is contained in:
kalmar 2017-03-15 17:56:01 +01:00
parent 120def0ef2
commit bdf97be22c

View File

@ -67,7 +67,7 @@ function distance_to_cone{T<:Rational}(κ::T, sqrt_matrix::Array{T,2}, Δ::Group
SOS_diff = EOI(Δ, κ) - SOS
eoi_SOS_L₁_dist = norm(SOS_diff,1)
info(logger, "κ = ")
info(logger, "κ = (≈$(float(κ)))")
ɛ_dist = GroupAlgebras.ɛ(SOS_diff)
if ɛ_dist 0//1
warn(logger, "The SOS is not in the augmentation ideal, number below are meaningless!")
@ -86,7 +86,7 @@ function distance_to_cone{T<:Rational, S<:Interval}(κ::T, sqrt_matrix::Array{S,
SOS_diff = EOI(Δ, κ) - SOS
eoi_SOS_L₁_dist = norm(SOS_diff,1)
info(logger, "κ = ")
info(logger, "κ = (≈$(float(κ)))")
ɛ_dist = GroupAlgebras.ɛ(SOS_diff)
info(logger, "ɛ(Δ² - κΔ - ∑ξᵢ*ξᵢ) ∈ $(ɛ_dist)")
@ -102,7 +102,7 @@ function distance_to_cone{T<:AbstractFloat}(κ::T, sqrt_matrix::Array{T,2}, Δ::
SOS_diff = EOI(Δ, κ) - SOS
eoi_SOS_L₁_dist = norm(SOS_diff,1)
info(logger, "κ = (≈$(float(κ)))")
info(logger, "κ = ")
ɛ_dist = GroupAlgebras.ɛ(SOS_diff)
info(logger, "ɛ(Δ² - κΔ - ∑ξᵢ*ξᵢ) ≈ $(@sprintf("%.10f\n", ɛ_dist))")
info(logger, "‖Δ² - κΔ - ∑ξᵢ*ξᵢ‖₁ ≈ $(@sprintf("%.10f\n", eoi_SOS_L₁_dist))")
@ -119,13 +119,12 @@ function check_distance_to_positive_cone(Δ::GroupAlgebraElement, κ, A;
@assert A == Symmetric(A)
A_sqrt = real(sqrtm(A))
info(logger, "-------------------------------------------------------------")
info(logger, "------------------------------------------------------------")
info(logger, "")
info(logger, "Checking in floating-point arithmetic...")
@time fp_distance = distance_to_cone(κ, A_sqrt, Δ)
info(logger, "Floating point distance (to positive cone)\n$(Float64(trunc(fp_distance,10)))")
info(logger, "-------------------------------------------------------------")
info(logger, "")
info(logger, "Floating point distance (to positive cone) ≈ $(Float64(trunc(fp_distance,10)))")
info(logger, "------------------------------------------------------------")
info(logger, "Projecting columns of rationalized A_sqrt to the augmentation ideal...")
δ = eps(κ)
@ -137,9 +136,8 @@ function check_distance_to_positive_cone(Δ::GroupAlgebraElement, κ, A;
info(logger, "Checking in interval arithmetic")
A_sqrt__augᴵ = A_sqrt__aug ± δ
@time Interval_dist_to_Σ² = distance_to_cone(κ_, A_sqrt__augᴵ, Δ_)
info(logger, "The Augmentation-projected actual distance (to positive cone) belongs to \n$Interval_dist_to_Σ²")
info(logger, "-------------------------------------------------------------")
info(logger, "")
info(logger, "The Augmentation-projected actual distance (to positive cone) belongs to $Interval_dist_to_Σ²")
info(logger, "------------------------------------------------------------")
if Interval_dist_to_Σ².lo 0
return Interval_dist_to_Σ².lo
@ -147,8 +145,8 @@ function check_distance_to_positive_cone(Δ::GroupAlgebraElement, κ, A;
info(logger, "Checking Projected SOS decomposition in exact rational arithmetic...")
@time _dist_to_Σ² = distance_to_cone(κ_, A_sqrt__aug, Δ_)
@assert isa(_dist_to_Σ², Rational)
info(logger, "Augmentation-projected rational distance (to positive cone)\n$(Float64(trunc(_dist_to_Σ²,8)))")
info(logger, "-------------------------------------------------------------")
info(logger, "Augmentation-projected rational distance (to positive cone)$(Float64(trunc(_dist_to_Σ²,8)))")
info(logger, "------------------------------------------------------------")
return _dist_to_Σ²
end
end