From deedcf707b1624fe1bd7a4979349f45b565b3fe2 Mon Sep 17 00:00:00 2001 From: kalmar Date: Fri, 13 Jan 2017 18:07:41 +0100 Subject: [PATCH] Use the norm function; shuffle returns of check_solution --- SL(3,Z).jl | 11 +++++++++-- property(T).jl | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SL(3,Z).jl b/SL(3,Z).jl index 8489f04..548b7b9 100644 --- a/SL(3,Z).jl +++ b/SL(3,Z).jl @@ -55,10 +55,17 @@ A = readdlm("matrix.A.Mosek") 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, κ;) A_sqrt_rational = rationalize(BigInt, A_sqrt) Δ_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)) diff --git a/property(T).jl b/property(T).jl index 28ce397..c309458 100644 --- a/property(T).jl +++ b/property(T).jl @@ -160,7 +160,8 @@ function check_solution{T<:Number}(κ::T, Δ::GroupAlgebraElement{T}) eoi = EOI(Δ, κ) 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 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) return r.(X) -end +end;