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

Move sqrtm out of check_distance_to_positive_cone

This commit is contained in:
kalmar 2017-06-22 11:56:46 +02:00
parent 39732bb627
commit 21e6811292
2 changed files with 8 additions and 7 deletions

View File

@ -192,7 +192,13 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
info(logger, "minimum(P) = $(minimum(P))") info(logger, "minimum(P) = $(minimum(P))")
if λ > 0 if λ > 0
sgap = check_distance_to_positive_cone(Δ, λ, P, 2*radius, tol=tol, rational=false)
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
warn("The solution matrix doesn't seem to be positive definite!")
# @assert P == Symmetric(P)
Q = real(sqrtm(Symmetric(P)))
sgap = check_distance_to_positive_cone(Δ, λ, Q, 2*radius, tol=tol, rational=false)
if isa(sgap, Interval) if isa(sgap, Interval)
sgap = sgap.lo sgap = sgap.lo
end end

View File

@ -110,14 +110,9 @@ function distance_to_cone(λ, sqrt_matrix::Array, Δ::GroupRingElem, wlen)
return distance_to_cone return distance_to_cone
end end
function check_distance_to_positive_cone(Δ::GroupRingElem, λ, P, wlen; function check_distance_to_positive_cone(Δ::GroupRingElem, λ, Q, wlen;
tol=1e-7, rational=false) tol=1e-7, rational=false)
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
warn("The solution matrix doesn't seem to be positive definite!")
# @assert P == Symmetric(P)
Q = real(sqrtm(P))
info(logger, "------------------------------------------------------------") info(logger, "------------------------------------------------------------")
info(logger, "") info(logger, "")
info(logger, "Checking in floating-point arithmetic...") info(logger, "Checking in floating-point arithmetic...")