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