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

greatly simplify OrbitData struct

This commit is contained in:
kalmarek 2018-08-20 03:54:03 +02:00
parent ed181d14f8
commit aad4359832

View File

@ -21,44 +21,25 @@ suffix(s::Settings) = "$(s.upper_bound)"
prepath(s::Settings) = prefix(s) prepath(s::Settings) = prefix(s)
fullpath(s::Settings) = joinpath(prefix(s), suffix(s)) fullpath(s::Settings) = joinpath(prefix(s), suffix(s))
immutable OrbitData{T<:AbstractArray{Float64, 2}, LapType <:AbstractVector{Float64}} struct OrbitData{T<:AbstractArray{Float64, 2}}
name::String orbits::Vector{Vector{Int}}
Us::Vector{T} Uπs::Vector{T}
Ps::Vector{Array{JuMP.Variable,2}}
cnstr::Vector{SparseMatrixCSC{Float64, Int}}
laplacian::LapType
laplacianSq::LapType
dims::Vector{Int} dims::Vector{Int}
end end
function OrbitData(sett::Settings) function OrbitData(sett::Settings)
splap = load(filename(prepath(sett), ), "Δ"); info("Loading Uπs, dims, orbits...")
pm = load(filename(prepath(sett), :pm), "pm");
cnstr = PropertyT.constraints(pm);
splap² = similar(splap)
splap² = GroupRings.mul!(splap², splap, splap, pm);
Uπs = load(filename(prepath(sett), :Uπs), "Uπs") Uπs = load(filename(prepath(sett), :Uπs), "Uπs")
nzros = [i for i in 1:length(Uπs) if size(Uπs[i],2) !=0] nzros = [i for i in 1:length(Uπs) if size(Uπs[i],2) !=0]
Uπs = Uπs[nzros] Uπs = Uπs[nzros]
Uπs = map(x -> sparsify!(x, sett.tol, verbose=true), Uπs)
Uπs = map(x -> sparsify!(x, sett.tol/100, verbose=true), Uπs)
#dimensions of the corresponding πs: #dimensions of the corresponding πs:
dims = load(filename(prepath(sett), :Uπs), "dims")[nzros] dims = load(filename(prepath(sett), :Uπs), "dims")[nzros]
m, P = init_model(size(Uπs,1), [size(U,2) for U in Uπs]); orbits = load(filename(prepath(sett), :orbits), "orbits");
orbits = load(filename(prepath(sett), :orb), "orbits"); return OrbitData(orbits, Uπs, dims)
n = size(Uπs[1],1)
orb_spcnstrm = [orbit_constraint(cnstr[collect(orb)], n) for orb in orbits]
orb_splap = orbit_spvector(splap, orbits)
orb_splap² = orbit_spvector(splap², orbits)
orbData = OrbitData(fullpath(sett), Uπs, P, orb_spcnstrm, orb_splap, orb_splap², dims);
# orbData = OrbitData(name, Uπs, P, orb_spcnstrm, splap, splap², dims);
return m, orbData
end end
include("OrbitDecomposition.jl") include("OrbitDecomposition.jl")