mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-14 14:15:28 +01:00
replace radius by halfradius where appropriate
This commit is contained in:
parent
f2311fa975
commit
4c4ef195e1
@ -12,7 +12,7 @@ struct Naive{El} <: Settings
|
||||
name::String
|
||||
G::Group
|
||||
S::Vector{El}
|
||||
radius::Int
|
||||
halfradius::Int
|
||||
upper_bound::Float64
|
||||
|
||||
solver::JuMP.OptimizerFactory
|
||||
@ -24,7 +24,7 @@ struct Symmetrized{El} <: Settings
|
||||
G::Group
|
||||
S::Vector{El}
|
||||
autS::Group
|
||||
radius::Int
|
||||
halfradius::Int
|
||||
upper_bound::Float64
|
||||
|
||||
solver::JuMP.OptimizerFactory
|
||||
@ -33,14 +33,14 @@ end
|
||||
|
||||
function Settings(name::String,
|
||||
G::Group, S::Vector{<:GroupElem}, solver::JuMP.OptimizerFactory;
|
||||
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||
return Naive(name, G, S, radius, upper_bound, solver, warmstart)
|
||||
halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||
return Naive(name, G, S, halfradius, upper_bound, solver, warmstart)
|
||||
end
|
||||
|
||||
function Settings(name::String,
|
||||
G::Group, S::Vector{<:GroupElem}, autS::Group, solver::JuMP.OptimizerFactory;
|
||||
radius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||
return Symmetrized(name, G, S, autS, radius, upper_bound, solver, warmstart)
|
||||
halfradius::Integer=2, upper_bound::Float64=1.0, warmstart=true)
|
||||
return Symmetrized(name, G, S, autS, halfradius, upper_bound, solver, warmstart)
|
||||
end
|
||||
|
||||
prefix(s::Naive) = s.name
|
||||
@ -245,7 +245,7 @@ function print_summary(sett::Settings)
|
||||
separator = "="^76
|
||||
info_strs = [separator,
|
||||
"Running tests for $(sett.name):",
|
||||
"Upper bound for λ: $(sett.upper_bound), on radius $(sett.radius).",
|
||||
"Upper bound for λ: $(sett.upper_bound), on halfradius $(sett.halfradius).",
|
||||
"Warmstart: $(sett.warmstart)",
|
||||
"Results will be stored in ./$(PropertyT.prepath(sett))",
|
||||
"Solver: $(typeof(sett.solver()))",
|
||||
@ -279,7 +279,7 @@ function spectral_gap(sett::Settings)
|
||||
loadGRElem(filename(sett,:Δ), sett.G)
|
||||
catch
|
||||
# compute
|
||||
Δ = Laplacian(sett.S, sett.radius)
|
||||
Δ = Laplacian(sett.S, sett.halfradius)
|
||||
saveGRElem(filename(sett, :Δ), Δ)
|
||||
Δ
|
||||
end
|
||||
@ -307,7 +307,7 @@ function spectral_gap(sett::Settings)
|
||||
@warn "The solution matrix doesn't seem to be positive definite!"
|
||||
|
||||
@time Q = real(sqrt(Symmetric( (P.+ P')./2 )))
|
||||
certified_sgap = spectral_gap(Δ, λ, Q, R=sett.radius)
|
||||
certified_sgap = spectral_gap(Δ, λ, Q, R=sett.halfradius)
|
||||
|
||||
return certified_sgap
|
||||
end
|
||||
|
@ -22,24 +22,24 @@ function spLaplacian(RG::GroupRing, S::Vector{REl}, T::Type=Float64) where {REl<
|
||||
return result
|
||||
end
|
||||
|
||||
function Laplacian(S::Vector{E}, radius) where E<:AbstractAlgebra.ModuleElem
|
||||
function Laplacian(S::Vector{E}, halfradius) where E<:AbstractAlgebra.ModuleElem
|
||||
R = parent(first(S))
|
||||
return Laplacian(S, one(R), radius)
|
||||
return Laplacian(S, one(R), halfradius)
|
||||
end
|
||||
|
||||
function Laplacian(S::Vector{E}, radius) where E<:AbstractAlgebra.GroupElem
|
||||
function Laplacian(S::Vector{E}, halfradius) where E<:AbstractAlgebra.GroupElem
|
||||
G = parent(first(S))
|
||||
return Laplacian(S, G(), radius)
|
||||
return Laplacian(S, G(), halfradius)
|
||||
end
|
||||
|
||||
function Laplacian(S, Id, radius)
|
||||
@info "Generating metric ball of radius" radius=2radius
|
||||
@time E_R, sizes = Groups.generate_balls(S, Id, radius=2radius)
|
||||
function Laplacian(S, Id, halfradius)
|
||||
@info "Generating metric ball of radius" radius=2halfradius
|
||||
@time E_R, sizes = Groups.generate_balls(S, Id, radius=2halfradius)
|
||||
@info "Generated balls:" sizes
|
||||
|
||||
@info "Creating product matrix..."
|
||||
rdict = GroupRings.reverse_dict(E_R)
|
||||
@time pm = GroupRings.create_pm(E_R, rdict, sizes[radius]; twisted=true)
|
||||
@time pm = GroupRings.create_pm(E_R, rdict, sizes[halfradius]; twisted=true)
|
||||
|
||||
RG = GroupRing(parent(Id), E_R, rdict, pm)
|
||||
Δ = spLaplacian(RG, S)
|
||||
|
Loading…
Reference in New Issue
Block a user