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

another rework of filenames

This commit is contained in:
kalmarek 2018-01-02 02:55:53 +01:00
parent 0d17e4b877
commit 7d22e8dce0
3 changed files with 28 additions and 17 deletions

View File

@ -32,23 +32,23 @@ immutable OrbitData{T<:AbstractArray{Float64, 2}, LapType <:AbstractVector{Float
end end
function OrbitData(sett::Settings) function OrbitData(sett::Settings)
splap = load(joinpath(prepath(sett), "delta.jld"), "Δ"); splap = load(filename(prepath(sett), ), "Δ");
pm = load(joinpath(prepath(sett), "pm.jld"), "pm"); pm = load(filename(prepath(sett), :pm), "pm");
cnstr = PropertyT.constraints(pm); cnstr = PropertyT.constraints(pm);
splap² = similar(splap) splap² = similar(splap)
splap² = GroupRings.mul!(splap², splap, splap, pm); splap² = GroupRings.mul!(splap², splap, splap, pm);
Uπs = load(joinpath(prepath(sett), "U_pis.jld"), "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 = sparsify!.(Uπs, sett.tol, check=true, verbose=true) Uπs = sparsify!.(Uπs, sett.tol, check=true, verbose=true)
#dimensions of the corresponding πs: #dimensions of the corresponding πs:
dims = load(joinpath(prepath(sett), "U_pis.jld"), "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]); m, P = init_model(size(Uπs,1), [size(U,2) for U in Uπs]);
orbits = load(joinpath(prepath(sett), "orbits.jld"), "orbits"); orbits = load(filename(prepath(sett), :orb), "orbits");
n = size(Uπs[1],1) n = size(Uπs[1],1)
orb_spcnstrm = [orbit_constraint(cnstr[collect(orb)], n) for orb in orbits] orb_spcnstrm = [orbit_constraint(cnstr[collect(orb)], n) for orb in orbits]
orb_splap = orbit_spvector(splap, orbits) orb_splap = orbit_spvector(splap, orbits)
@ -206,7 +206,7 @@ function λandP(m::JuMP.Model, data::OrbitData, sett::Settings)
info(LOGGER, "Reconstructing P...") info(LOGGER, "Reconstructing P...")
preps = load_preps(joinpath(prepath(sett), "preps.jld"), sett.autS) preps = load_preps(filename(prepath(sett), :preps), sett.autS)
@logtime LOGGER recP = reconstruct_sol(preps, data.Us, Ps, data.dims) @logtime LOGGER recP = reconstruct_sol(preps, data.Us, Ps, data.dims)

View File

@ -184,8 +184,8 @@ function compute_orbit_data{T<:GroupElem}(logger, name::String, G::Nemo.Group, S
RG = GroupRing(G, E_2R, E_rdict, pm) RG = GroupRing(G, E_2R, E_rdict, pm)
Δ = PropertyT.spLaplacian(RG, S) Δ = PropertyT.spLaplacian(RG, S)
@assert GroupRings.augmentation(Δ) == 0 @assert GroupRings.augmentation(Δ) == 0
save(joinpath(name, "delta.jld"), "Δ", Δ.coeffs) save(filename(name, ), "Δ", Δ.coeffs)
save(joinpath(name, "pm.jld"), "pm", pm) save(filename(name, :pm), "pm", pm)
info(logger, "Decomposing E into orbits of $(autS)") info(logger, "Decomposing E into orbits of $(autS)")
@logtime logger orbs = orbit_decomposition(autS, E_2R, E_rdict) @logtime logger orbs = orbit_decomposition(autS, E_2R, E_rdict)
@ -195,7 +195,7 @@ function compute_orbit_data{T<:GroupElem}(logger, name::String, G::Nemo.Group, S
info(logger, "Action matrices") info(logger, "Action matrices")
@logtime logger reps = perm_reps(autS, E_2R[1:sizes[radius]], E_rdict) @logtime logger reps = perm_reps(autS, E_2R[1:sizes[radius]], E_rdict)
save_preps(joinpath(name, "preps.jld"), reps) save_preps(filename(name, :preps), reps)
reps = matrix_reps(reps) reps = matrix_reps(reps)
info(logger, "Projections") info(logger, "Projections")

View File

@ -70,15 +70,26 @@ end
exists(fname::String) = isfile(fname) || islink(fname) exists(fname::String) = isfile(fname) || islink(fname)
function filename(prefix, s::Symbol) filename(prefix, s::Symbol) = filename(prefix, Val{s})
isdir(prefix) || mkdir(prefix)
return filename(prefix, Val{s})
end
filename(prefix::String, ::Type{Val{:pm}}) = joinpath(prefix, "pm.jld") @eval begin
filename(prefix::String, ::Type{Val{}}) = joinpath(prefix, "delta.jld") for (s,n) in [
filename(prefix::String, ::Type{Val{}}) = joinpath(prefix, "lambda.jld") [:pm, "pm.jld"],
filename(prefix::String, ::Type{Val{:P}}) = joinpath(prefix, "SDPmatrix.jld") [, "delta.jld"],
[, "lambda.jld"],
[:P, "SDPmatrix.jld"],
[:warm, "warmstart.jld"],
[:Uπs, "U_pis.jld"],
[:orb, "orbits.jld"],
[:preps,"preps.jld"],
[:logall, "full_$(string(now())).log"],
[:logsolver,"solver_$(string(now())).log"]
]
filename(prefix::String, ::Type{Val{$:(s)}}) = joinpath(prefix, :($n))
end
end
function Laplacian(name::String, G::Group) function Laplacian(name::String, G::Group)
info(LOGGER, "Loading precomputed Δ...") info(LOGGER, "Loading precomputed Δ...")