mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-14 14:15:28 +01:00
cosmetics
This commit is contained in:
parent
9612dd7b66
commit
a40945380a
@ -131,6 +131,7 @@ function check_solution(κ, sqrt_matrix, Δ; verbose=true, augmented=false)
|
||||
eoi_SOS_L₁_dist = norm(SOS_diff,1)
|
||||
|
||||
if verbose
|
||||
@show κ
|
||||
if augmented
|
||||
println("ɛ(Δ² - κΔ - ∑ξᵢ*ξᵢ) = ", GroupAlgebras.ɛ(SOS_diff))
|
||||
else
|
||||
@ -162,31 +163,30 @@ function ℚ_distance_to_positive_cone(Δ::GroupAlgebraElement,
|
||||
|
||||
@show maximum(A)
|
||||
if maximum(A) < 1e-2
|
||||
warn("Solver might not solved the problem successfully and what You're seeing is due to floating-point error, proceeding anyway...")
|
||||
warn("Solver might not solved the problem successfully and the positive solution is due to floating-point error, proceeding anyway...")
|
||||
end
|
||||
|
||||
@assert isapprox(eigvals(A), abs(eigvals(A)), atol=TOL)
|
||||
@assert A == Symmetric(A)
|
||||
println("")
|
||||
A_sqrt = real(sqrtm(A))
|
||||
println("")
|
||||
|
||||
println("Checking in floating-point arithmetic...")
|
||||
@show κ
|
||||
fp_distance = check_solution(κ, A_sqrt, Δ, verbose=VERBOSE)
|
||||
println("Distance to positive cone ≈ $(Float64(trunc(fp_distance,8)))")
|
||||
println("-------------------------------------------------------------")
|
||||
println("")
|
||||
println("Checking in rational arithmetic...")
|
||||
|
||||
println("Checking in rational arithmetic...")
|
||||
κ_ℚ = ℚ(trunc(κ,Int(abs(log10(tol)))), TOL)
|
||||
@show κ_ℚ
|
||||
@assert κ - κ_ℚ ≥ 0
|
||||
A_sqrt_ℚ, Δ_ℚ = ℚ(A_sqrt, TOL), ℚ(Δ, TOL)
|
||||
|
||||
ℚ_distance = check_solution(κ_ℚ, A_sqrt_ℚ, Δ_ℚ, verbose=VERBOSE)
|
||||
@assert isa(ℚ_distance, Rational)
|
||||
println("Distance to positive cone ≈ $(Float64(trunc(ℚ_distance,8)))")
|
||||
println("-------------------------------------------------------------")
|
||||
println("")
|
||||
|
||||
println("Projecting columns of A_sqrt to the augmentation ideal...")
|
||||
A_sqrt_ℚ_aug = correct_to_augmentation_ideal(A_sqrt_ℚ)
|
||||
ℚ_dist_to_Σ² = check_solution(κ_ℚ, A_sqrt_ℚ_aug, Δ_ℚ, verbose=VERBOSE, augmented=true)
|
||||
|
Loading…
Reference in New Issue
Block a user