1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15:29 +01:00

rename OrbitData → BlockDecomposition

This commit is contained in:
kalmarek 2020-10-17 11:39:19 +02:00
parent 0d48ff698c
commit 1e14380942
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
5 changed files with 18 additions and 18 deletions

View File

@ -51,8 +51,8 @@ filename(sett::Settings, ::Type{Val{:solverlog}}; kwargs...) =
filename(sett::Settings, ::Type{Val{}}; kwargs...) = filename(sett::Settings, ::Type{Val{}}; kwargs...) =
filename(prepath(sett), "delta", "jld"; kwargs...) filename(prepath(sett), "delta", "jld"; kwargs...)
filename(sett::Settings, ::Type{Val{:OrbitData}}; kwargs...) = filename(sett::Settings, ::Type{Val{:BlockDecomposition}}; kwargs...) =
filename(prepath(sett), "OrbitData", "jld"; kwargs...) filename(prepath(sett), "BlockDecomposition", "jld"; kwargs...)
filename(sett::Settings, ::Type{Val{:solution}}; kwargs...) = filename(sett::Settings, ::Type{Val{:solution}}; kwargs...) =
filename(fullpath(sett), "solution", "jld"; kwargs...) filename(fullpath(sett), "solution", "jld"; kwargs...)
@ -125,7 +125,7 @@ function approximate_by_SOS(sett::Symmetrized,
isdir(fullpath(sett)) || mkpath(fullpath(sett)) isdir(fullpath(sett)) || mkpath(fullpath(sett))
orbit_data = try orbit_data = try
orbit_data = load(filename(sett, :OrbitData), "OrbitData") orbit_data = load(filename(sett, :BlockDecomposition), "BlockDecomposition")
@info "Loaded orbit data." @info "Loaded orbit data."
orbit_data orbit_data
catch ex catch ex
@ -133,8 +133,8 @@ function approximate_by_SOS(sett::Symmetrized,
GroupRings.hasbasis(parent(orderunit)) || GroupRings.hasbasis(parent(orderunit)) ||
throw("You need to define basis of Group Ring to compute orbit decomposition!") throw("You need to define basis of Group Ring to compute orbit decomposition!")
@info "Computing orbit and Wedderburn decomposition..." @info "Computing orbit and Wedderburn decomposition..."
orbit_data = OrbitData(parent(orderunit), sett.autS) orbit_data = BlockDecomposition(parent(orderunit), sett.autS)
save(filename(sett, :OrbitData), "OrbitData", orbit_data) save(filename(sett, :BlockDecomposition), "BlockDecomposition", orbit_data)
orbit_data orbit_data
end end

View File

@ -16,7 +16,7 @@ import AbstractAlgebra: Group, NCRing
include("laplacians.jl") include("laplacians.jl")
include("RGprojections.jl") include("RGprojections.jl")
include("orbitdata.jl") include("blockdecomposition.jl")
include("sos_sdps.jl") include("sos_sdps.jl")
include("checksolution.jl") include("checksolution.jl")

View File

@ -1,17 +1,17 @@
############################################################################### ###############################################################################
# #
# OrbitData # BlockDecomposition
# #
############################################################################### ###############################################################################
struct OrbitData{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:Generic.Perm} struct BlockDecomposition{T<:AbstractArray{Float64, 2}, GEl<:GroupElem, P<:Generic.Perm}
orbits::Vector{Vector{Int}} orbits::Vector{Vector{Int}}
preps::Dict{GEl, P} preps::Dict{GEl, P}
Uπs::Vector{T} Uπs::Vector{T}
dims::Vector{Int} dims::Vector{Int}
end end
function OrbitData(RG::GroupRing, autS::Group, verbose=true) function BlockDecomposition(RG::GroupRing, autS::Group, verbose=true)
verbose && @info "Decomposing basis of RG into orbits of" autS verbose && @info "Decomposing basis of RG into orbits of" autS
@time orbs = orbit_decomposition(autS, RG.basis, RG.basis_dict) @time orbs = orbit_decomposition(autS, RG.basis, RG.basis_dict)
@assert sum(length(o) for o in orbs) == length(RG.basis) @assert sum(length(o) for o in orbs) == length(RG.basis)
@ -38,17 +38,17 @@ function OrbitData(RG::GroupRing, autS::Group, verbose=true)
end end
@assert dot(multiplicities, dimensions) == size(RG.pm,1) @assert dot(multiplicities, dimensions) == size(RG.pm,1)
return OrbitData(orbs, preps, Uπs, dimensions) return BlockDecomposition(orbs, preps, Uπs, dimensions)
end end
function decimate(od::OrbitData, verbose=true) function decimate(od::BlockDecomposition, verbose=true)
nzros = [i for i in 1:length(od.Uπs) if !isempty(od.Uπs[i])] nzros = [i for i in 1:length(od.Uπs) if !isempty(od.Uπs[i])]
Us = sparsify!.(od.Uπs, eps(Float64) * 1e4, verbose = verbose)[nzros] Us = sparsify!.(od.Uπs, eps(Float64) * 1e4, verbose = verbose)[nzros]
#dimensions of the corresponding Uπs: #dimensions of the corresponding Uπs:
dims = od.dims[nzros] dims = od.dims[nzros]
return OrbitData(od.orbits, od.preps, Array{Float64}.(Us), dims) return BlockDecomposition(od.orbits, od.preps, Array{Float64}.(Us), dims)
end end
function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat} function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}

View File

@ -104,7 +104,7 @@ end
# #
############################################################################### ###############################################################################
function SOS_problem_primal(X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData; upper_bound::Float64=Inf) function SOS_problem_primal(X::GroupRingElem, orderunit::GroupRingElem, data::BlockDecomposition; upper_bound::Float64=Inf)
Ns = size.(data.Uπs, 2) Ns = size.(data.Uπs, 2)
m = JuMP.Model(); m = JuMP.Model();
@ -137,7 +137,7 @@ end
function addconstraints!(m::JuMP.Model, function addconstraints!(m::JuMP.Model,
P::Vector{Matrix{JuMP.VariableRef}}, P::Vector{Matrix{JuMP.VariableRef}},
X::GroupRingElem, orderunit::GroupRingElem, data::OrbitData) X::GroupRingElem, orderunit::GroupRingElem, data::BlockDecomposition)
orderunit_orb = orbit_spvector(orderunit.coeffs, data.orbits) orderunit_orb = orbit_spvector(orderunit.coeffs, data.orbits)
X_orb = orbit_spvector(X.coeffs, data.orbits) X_orb = orbit_spvector(X.coeffs, data.orbits)
@ -163,7 +163,7 @@ function addconstraints!(m::JuMP.Model,
return m return m
end end
function reconstruct(Ps::Vector{Matrix{F}}, data::OrbitData) where F function reconstruct(Ps::Vector{Matrix{F}}, data::BlockDecomposition) where F
return reconstruct(Ps, data.preps, data.Uπs, data.dims) return reconstruct(Ps, data.preps, data.Uπs, data.dims)
end end

View File

@ -123,7 +123,7 @@ end
S = PropertyT.generating_set(M) S = PropertyT.generating_set(M)
Δ = PropertyT.Laplacian(S, halfradius) Δ = PropertyT.Laplacian(S, halfradius)
RG = parent(Δ) RG = parent(Δ)
orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N))) orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.decimate(orbit_data); orbit_data = PropertyT.decimate(orbit_data);
@testset "Sq₃ is SOS" begin @testset "Sq₃ is SOS" begin
@ -170,7 +170,7 @@ end
S = PropertyT.generating_set(M) S = PropertyT.generating_set(M)
Δ = PropertyT.Laplacian(S, halfradius) Δ = PropertyT.Laplacian(S, halfradius)
RG = parent(Δ) RG = parent(Δ)
orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N))) orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
orbit_data = PropertyT.decimate(orbit_data); orbit_data = PropertyT.decimate(orbit_data);
@testset "Sq₄ is SOS" begin @testset "Sq₄ is SOS" begin
@ -228,7 +228,7 @@ end
# S = PropertyT.generating_set(M) # S = PropertyT.generating_set(M)
# Δ = PropertyT.Laplacian(S, halfradius) # Δ = PropertyT.Laplacian(S, halfradius)
# RG = parent(Δ) # RG = parent(Δ)
# orbit_data = PropertyT.OrbitData(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N))) # orbit_data = PropertyT.BlockDecomposition(RG, WreathProduct(SymmetricGroup(2), SymmetricGroup(N)))
# orbit_data = PropertyT.decimate(orbit_data); # orbit_data = PropertyT.decimate(orbit_data);
# #
# @time elt = PropertyT.Adj(RG) + 100PropertyT.Op(RG) # @time elt = PropertyT.Adj(RG) + 100PropertyT.Op(RG)