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

simplify \DeltaandSDPconstr...

This commit is contained in:
kalmar 2017-06-05 13:17:49 +02:00
parent 9d72141624
commit 923b4f9305

View File

@ -31,39 +31,22 @@ function λSDPfilenames(name::String)
end end
function ΔandSDPconstraints(name::String) function ΔandSDPconstraints(name::String)
pm_fname, Δ_fname = pmΔfilenames(name) info(logger, "Loading precomputed pm, Δ, sdp_constraints...")
f₁ = isfile(pm_fname) product_matrix = load(pm_fname, "pm")
f₂ = isfile(Δ_fname) L = load(Δ_fname, "Δ")[:, 1]
if f₁ && f₂ && false Δ = GroupRingElem(L, Array{Int,2}(product_matrix))
info(logger, "Loading precomputed pm, Δ, sdp_constraints...") sdp_constraints = constraints_from_pm(product_matrix)
product_matrix = load(pm_fname, "pm")
L = load(Δ_fname, "Δ")[:, 1]
Δ = GroupRingElem(L, Array{Int,2}(product_matrix))
sdp_constraints = constraints_from_pm(product_matrix)
else
throw(ArgumentError("You need to precompute pm and Δ to load it!"))
end
return Δ, sdp_constraints return Δ, sdp_constraints
end end
function ΔandSDPconstraints(name::String, generating_set::Function, radius::Int) function ΔandSDPconstraints{T<:GroupElem}(name::String, S::Vector{T}, radius::Int)
try S, Id = generating_set()
return ΔandSDPconstraints(name) info(logger, "Computing pm, Δ, sdp_constraints...")
catch err t = @timed Δ, sdp_constraints = ΔandSDPconstraints(S, radius)
if isa(err, ArgumentError) info(logger, timed_msg(t))
pm_fname, Δ_fname = pmΔfilenames(name) pm_fname, Δ_fname = pmΔfilenames(name)
S, Id = generating_set() save(pm_fname, "pm", parent(Δ).pm)
info(logger, "Computing pm, Δ, sdp_constraints...") save(Δ_fname, "Δ", Δ.coeffs)
t = @timed Δ, sdp_constraints = Main.ΔandSDPconstraints(Id, S, radius)
info(logger, timed_msg(t))
save(pm_fname, "pm", parent(Δ).pm)
save(Δ_fname, "Δ", Δ.coeffs)
return Δ, sdp_constraints
else
error(logger, err)
end
end
end end
function timed_msg(t) function timed_msg(t)
@ -155,7 +138,10 @@ function check_property_T(name::String, generating_set::Function,
setup_logging(name) setup_logging(name)
Δ, sdp_constraints = ΔandSDPconstraints(name, generating_set, radius) if all(isfile.(pmΔfilenames(name))) && false
Δ, sdp_constraints = ΔandSDPconstraints(name)
else
Δ, sdp_constraints = ΔandSDPconstraints(name, generating_set, radius)
S = countnz(Δ.coeffs) - 1 S = countnz(Δ.coeffs) - 1
info(logger, "|S| = $S") info(logger, "|S| = $S")