mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 10:35:29 +01:00
extract checking if lambda > 0 ... block to a separate function
This commit is contained in:
parent
2d62aa26f2
commit
0c2f5b1a9a
@ -248,18 +248,5 @@ function check_property_T(sett::Settings)
|
|||||||
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!")
|
warn("The solution matrix doesn't seem to be positive definite!")
|
||||||
|
|
||||||
if λ > 0
|
return interpret_results(sett.name, sett.S, sett.radius, λ, P, sett.logger)
|
||||||
RG = GroupRing(parent(first(sett.S)), load(filename(sett.name, :pm), "pm"))
|
|
||||||
Δ = RG(load(filename(name, :Δ), "Δ")[:, 1])
|
|
||||||
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
|
||||||
|
|
||||||
sgap = distance_to_cone(Δ, λ, Q, wlen=2*sett.radius, logger=sett.logger)
|
|
||||||
Kazhdan_κ = Kazhdan(sgap, length(S))
|
|
||||||
if Kazhdan_κ > 0
|
|
||||||
info(logger, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
info(LOGGER, "κ($name, S) ≥ $λ < 0: Tells us nothing about property (T)")
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
@ -157,15 +157,15 @@ Kazhdan(λ::Number,N::Integer) = sqrt(2*λ/N)
|
|||||||
function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius, warm::Bool=false)
|
function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius, warm::Bool=false)
|
||||||
|
|
||||||
isdir(name) || mkdir(name)
|
isdir(name) || mkdir(name)
|
||||||
LOGGER = Memento.getlogger()
|
logger = Memento.getlogger()
|
||||||
|
|
||||||
if exists(filename(name, :pm)) && exists(filename(name, :Δ))
|
if exists(filename(name, :pm)) && exists(filename(name, :Δ))
|
||||||
# cached
|
# cached
|
||||||
info(LOGGER, "Loading precomputed Δ...")
|
info(logger, "Loading precomputed Δ...")
|
||||||
Δ = Laplacian(name, parent(S[1]))
|
Δ = Laplacian(name, parent(S[1]))
|
||||||
else
|
else
|
||||||
# compute
|
# compute
|
||||||
Δ = Laplacian(S, Id, LOGGER, radius=radius)
|
Δ = Laplacian(S, Id, logger, radius=radius)
|
||||||
save(filename(name, :pm), "pm", parent(Δ).pm)
|
save(filename(name, :pm), "pm", parent(Δ).pm)
|
||||||
save(filename(name, :Δ), "Δ", Δ.coeffs)
|
save(filename(name, :Δ), "Δ", Δ.coeffs)
|
||||||
end
|
end
|
||||||
@ -177,39 +177,44 @@ function check_property_T(name::String, S, Id, solver, upper_bound, tol, radius,
|
|||||||
cond2 = exists(filename(fullpath, :P))
|
cond2 = exists(filename(fullpath, :P))
|
||||||
|
|
||||||
if !(warm) && cond1 && cond2
|
if !(warm) && cond1 && cond2
|
||||||
info(LOGGER, "Loading precomputed λ, P...")
|
info(logger, "Loading precomputed λ, P...")
|
||||||
λ, P = λandP(fullpath)
|
λ, P = λandP(fullpath)
|
||||||
else
|
else
|
||||||
info(LOGGER, "Creating SDP problem...")
|
info(logger, "Creating SDP problem...")
|
||||||
SDP_problem, varλ, varP = create_SDP_problem(Δ, constraints(parent(Δ).pm), upper_bound=upper_bound)
|
SDP_problem, varλ, varP = create_SDP_problem(Δ, constraints(parent(Δ).pm), upper_bound=upper_bound)
|
||||||
JuMP.setsolver(SDP_problem, solver)
|
JuMP.setsolver(SDP_problem, solver)
|
||||||
info(LOGGER, Base.repr(SDP_problem))
|
info(logger, Base.repr(SDP_problem))
|
||||||
|
|
||||||
@logtime LOGGER λ, P = λandP(fullpath, SDP_problem, varλ, varP)
|
@logtime logger λ, P = λandP(fullpath, SDP_problem, varλ, varP)
|
||||||
end
|
end
|
||||||
|
|
||||||
info(LOGGER, "λ = $λ")
|
info(logger, "λ = $λ")
|
||||||
info(LOGGER, "sum(P) = $(sum(P))")
|
info(logger, "sum(P) = $(sum(P))")
|
||||||
info(LOGGER, "maximum(P) = $(maximum(P))")
|
info(logger, "maximum(P) = $(maximum(P))")
|
||||||
info(LOGGER, "minimum(P) = $(minimum(P))")
|
info(logger, "minimum(P) = $(minimum(P))")
|
||||||
|
|
||||||
isapprox(eigvals(P), abs.(eigvals(P)), atol=tol) ||
|
isapprox(eigvals(P), abs.(eigvals(P)), atol=tol) ||
|
||||||
warn("The solution matrix doesn't seem to be positive definite!")
|
warn("The solution matrix doesn't seem to be positive definite!")
|
||||||
|
|
||||||
if λ > 0
|
return interpret_results(name, S, radius, λ, P, logger)
|
||||||
|
end
|
||||||
|
|
||||||
|
function interpret_results(name, S, radius, λ, P, logger)
|
||||||
|
|
||||||
RG = GroupRing(parent(first(S)), load(filename(name, :pm), "pm"))
|
RG = GroupRing(parent(first(S)), load(filename(name, :pm), "pm"))
|
||||||
Δ = RG(load(filename(name, :Δ), "Δ")[:, 1])
|
Δ = GroupRingElem(load(filename(name, :Δ), "Δ")[:, 1], RG)
|
||||||
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
@logtime logger Q = real(sqrtm(Symmetric(P)))
|
||||||
|
|
||||||
sgap = distance_to_cone(Δ, λ, Q, wlen=2*radius, logger=LOGGER)
|
sgap = distance_to_cone(Δ, λ, Q, wlen=2*radius, logger=logger)
|
||||||
|
|
||||||
|
if sgap > 0
|
||||||
Kazhdan_κ = Kazhdan(sgap, length(S))
|
Kazhdan_κ = Kazhdan(sgap, length(S))
|
||||||
if Kazhdan_κ > 0
|
if Kazhdan_κ > 0
|
||||||
info(logger, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
info(logger, "κ($name, S) ≥ $Kazhdan_κ: Group HAS property (T)!")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
info(LOGGER, "κ($name, S) ≥ $λ < 0: Tells us nothing about property (T)")
|
info(logger, "λ($name, S) ≥ $sgap < 0: Tells us nothing about property (T)")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user