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

save and load OrbitData directly

This commit is contained in:
kalmarek 2018-09-16 18:15:34 +02:00
parent 9d6a6fa0f8
commit 0ccc782d2f
2 changed files with 4 additions and 42 deletions

View File

@ -86,12 +86,12 @@ function computeλandP(sett::Settings{Symmetrize},
files_exist = exists(filename(pdir,:Uπs)) && exists(filename(pdir,:orbits)) && exists(filename(pdir,:preps)) files_exist = exists(filename(pdir,:Uπs)) && exists(filename(pdir,:orbits)) && exists(filename(pdir,:preps))
if files_exist if isfile(filename(sett, :OrbitData))
orbit_data = load_OrbitData(sett) orbit_data = load(filename(sett, :OrbitData), "OrbitData")
else else
isdefined(parent(Δ), :basis) || throw("You need to define basis of Group Ring to compute orbit decomposition!") isdefined(parent(Δ), :basis) || throw("You need to define basis of Group Ring to compute orbit decomposition!")
orbit_data = compute_OrbitData(parent(Δ), sett.autS) orbit_data = OrbitData(parent(Δ), sett.autS)
save_OrbitData(sett, orbit_data) save(filename(sett, :OrbitData), "OrbitData", orbit_data)
end end
orbit_data = decimate(orbit_data) orbit_data = decimate(orbit_data)

View File

@ -46,44 +46,6 @@ function decimate(od::OrbitData)
return OrbitData(od.orbits, od.preps, full.(Us), dims); return OrbitData(od.orbits, od.preps, full.(Us), dims);
end end
function save_OrbitData(sett::Settings, data::OrbitData)
save_preps(filename(prepath(sett), :preps), data.preps)
save(filename(prepath(sett), :orbits),
"orbits", data.orbits)
save(filename(prepath(sett), :Uπs),
"Uπs", data.Uπs,
"dims", data.dims)
end
function load_OrbitData(sett::Settings)
info("Loading Uπs, dims, orbits...")
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]
Uπs = map(x -> sparsify!(x, sett.tol/100, verbose=true), Uπs)
#dimensions of the corresponding πs:
dims = load(filename(prepath(sett), :Uπs), "dims")
orbits = load(filename(prepath(sett), :orbits), "orbits")
preps = load_preps(filename(prepath(sett), :preps), sett.autS)
return OrbitData(orbits, preps, Uπs, dims)
end
function load_preps(fname::String, G::Group)
lded_preps = load(fname, "perms_d")
permG = PermutationGroup(length(first(lded_preps)))
@assert length(lded_preps) == order(G)
return Dict(k=>permG(v) for (k,v) in zip(elements(G), lded_preps))
end
function save_preps(fname::String, preps)
autS = parent(first(keys(preps)))
save(fname, "perms_d", [preps[elt].d for elt in elements(autS)])
end
function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat} function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
M = full(M) M = full(M)
fact = svdfact(M) fact = svdfact(M)