mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 10:20:30 +01:00
reduce code duplication
This commit is contained in:
parent
955c8fc49e
commit
f478081d4e
@ -243,32 +243,11 @@ function check_property_T(sett::Settings)
|
||||
info(sett.logger, "maximum(P) = $(maximum(P))")
|
||||
info(sett.logger, "minimum(P) = $(minimum(P))")
|
||||
|
||||
if λ > 0
|
||||
pm_fname = filename(prepath(sett), :pm)
|
||||
Δ_fname = filename(prepath(sett), :Δ)
|
||||
RG = GroupRing(sett.G, load(pm_fname, "pm"))
|
||||
Δ = GroupRingElem(load(Δ_fname, "Δ")[:, 1], RG)
|
||||
|
||||
isapprox(eigvals(P), abs.(eigvals(P)), atol=sett.tol) ||
|
||||
isapprox(eigvals(P), abs.(eigvals(P)), atol=sett.tol) ||
|
||||
warn("The solution matrix doesn't seem to be positive definite!")
|
||||
# @assert P == Symmetric(P)
|
||||
@logtime LOGGER Q = real(sqrtm(Symmetric(P)))
|
||||
|
||||
sgap = distance_to_positive_cone(Δ, λ, Q, 2*sett.radius, LOGGER)
|
||||
if isa(sgap, Interval)
|
||||
sgap = sgap.lo
|
||||
end
|
||||
if sgap > 0
|
||||
info(LOGGER, "λ ≥ $(Float64(trunc(sgap,12)))")
|
||||
Kazhdan_κ = PropertyT.Kazhdan_from_sgap(sgap, length(sett.S))
|
||||
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
||||
info(LOGGER, "κ($(sett.name), S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||
return true
|
||||
else
|
||||
sgap = Float64(trunc(sgap, 12))
|
||||
info(LOGGER, "λ($(sett.name), S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
||||
return false
|
||||
end
|
||||
if λ > 0
|
||||
return check_λ(sett.name, sett.S, λ, P, sett.radius, sett.logger)
|
||||
end
|
||||
info(sett.logger, "κ($(sett.name), S) ≥ $λ < 0: Tells us nothing about property (T)")
|
||||
return false
|
||||
|
@ -171,6 +171,28 @@ end
|
||||
|
||||
Kazhdan_from_sgap(λ,N) = sqrt(2*λ/N)
|
||||
|
||||
function check_λ(name, S, λ, P, radius, logger)
|
||||
|
||||
RG = GroupRing(parent(first(S)), load(filename(name, :pm), "pm"))
|
||||
Δ = GroupRingElem(load(filename(name, :Δ), "Δ")[:, 1], RG)
|
||||
|
||||
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
||||
|
||||
sgap = check_distance_to_cone(Δ, λ, Q, 2*radius, logger)
|
||||
|
||||
if sgap > 0
|
||||
info(logger, "λ ≥ $(Float64(trunc(sgap,12)))")
|
||||
Kazhdan_κ = Kazhdan_from_sgap(sgap, length(S))
|
||||
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
||||
info(logger, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||
return true
|
||||
else
|
||||
sgap = Float64(trunc(sgap, 12))
|
||||
info(logger, "λ($name, S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
||||
|
||||
isdir(name) || mkdir(name)
|
||||
@ -203,28 +225,11 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius)
|
||||
info(LOGGER, "maximum(P) = $(maximum(P))")
|
||||
info(LOGGER, "minimum(P) = $(minimum(P))")
|
||||
|
||||
isapprox(eigvals(P), abs.(eigvals(P)), atol=tol) ||
|
||||
warn("The solution matrix doesn't seem to be positive definite!")
|
||||
|
||||
if λ > 0
|
||||
|
||||
RG = GroupRing(parent(first(S)), load(filename(name, :pm), "pm"))
|
||||
Δ = GroupRingElem(load(filename(name, :Δ), "Δ")[:, 1], RG)
|
||||
|
||||
isapprox(eigvals(P), abs(eigvals(P)), atol=tol) ||
|
||||
warn("The solution matrix doesn't seem to be positive definite!")
|
||||
@logtime LOGGER Q = real(sqrtm(Symmetric(P)))
|
||||
|
||||
sgap = check_distance_to_cone(Δ, λ, Q, 2*radius, LOGGER)
|
||||
|
||||
if sgap > 0
|
||||
info(LOGGER, "λ ≥ $(Float64(trunc(sgap,12)))")
|
||||
Kazhdan_κ = Kazhdan_from_sgap(sgap, length(S))
|
||||
Kazhdan_κ = Float64(trunc(Kazhdan_κ, 12))
|
||||
info(LOGGER, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||
return true
|
||||
else
|
||||
sgap = Float64(trunc(sgap, 12))
|
||||
info(LOGGER, "λ($name, S) ≥ $sgap: Group may NOT HAVE property (T)!")
|
||||
return false
|
||||
end
|
||||
return check_λ(name, S, λ, P, radius, logger)
|
||||
end
|
||||
info(LOGGER, "κ($name, S) ≥ $λ < 0: Tells us nothing about property (T)")
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user