1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-19 15:25:29 +01:00

Use the norm function; shuffle returns of check_solution

This commit is contained in:
kalmar 2017-01-13 18:07:41 +01:00
parent bbd3027f95
commit deedcf707b
2 changed files with 12 additions and 4 deletions

View File

@ -55,10 +55,17 @@ A = readdlm("matrix.A.Mosek")
const A_sqrt = real(sqrtm(A)) const A_sqrt = real(sqrtm(A))
SOS_EOI_fp_L₁, Ω_fp_dist = check_solution(κ, A_sqrt, Δ) SOS_fp_diff, SOS_fp_L₁_distance = check_solution(κ, A_sqrt, Δ)
@show SOS_fp_L₁_distance
@show GroupAlgebras.ɛ(SOS_fp_diff)
κ_rational = rationalize(BigInt, κ;) κ_rational = rationalize(BigInt, κ;)
A_sqrt_rational = rationalize(BigInt, A_sqrt) A_sqrt_rational = rationalize(BigInt, A_sqrt)
Δ_rational = rationalize(BigInt, Δ) Δ_rational = rationalize(BigInt, Δ)
SOS_EOI_rat_L₁, Ω_rat_dist = check_solution(κ_rational, A_sqrt_rational, Δ_rational) SOS_rational_diff, SOS_rat_L₁_distance = check_solution(κ_rational, A_sqrt_rational, Δ_rational)
@assert isa(SOS_rat_L₁_distance, Rational{BigInt})
@show float(SOS_rat_L₁_distance)
@show float(GroupAlgebras.ɛ(SOS_rational_diff))

View File

@ -160,7 +160,8 @@ function check_solution{T<:Number}(κ::T,
Δ::GroupAlgebraElement{T}) Δ::GroupAlgebraElement{T})
eoi = EOI(Δ, κ) eoi = EOI(Δ, κ)
result = resulting_SOS(sqrt_matrix, Δ) result = resulting_SOS(sqrt_matrix, Δ)
return sum(abs.((result - eoi).coefficients)), sum(result.coefficients) L₁_dist = norm(result - eoi,1)
return eoi - result, L₁_dist
end end
function rationalize{T<:Integer, S<:Real}(::Type{T}, function rationalize{T<:Integer, S<:Real}(::Type{T},
@ -168,4 +169,4 @@ function rationalize{T<:Integer, S<:Real}(::Type{T},
r(x) = rationalize(T, x, tol=tol) r(x) = rationalize(T, x, tol=tol)
return r.(X) return r.(X)
end end;