mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-26 18:40:29 +01:00
simplify compute_orbit_data
by reusing of compute/load-Laplacian, etc
This commit is contained in:
parent
66ac37a6a7
commit
1825cc0b3d
@ -182,9 +182,19 @@ end
|
|||||||
|
|
||||||
function check_property_T(sett::Settings)
|
function check_property_T(sett::Settings)
|
||||||
|
|
||||||
ex(s) = exists(filename(prepath(sett), s))
|
ex(s::Symbol) = exists(filename(prepath(sett), s))
|
||||||
|
|
||||||
files_exists = ex.([:pm, :Δ, :Uπs, :orb, :preps])
|
if ex(:pm) && ex(:Δ)
|
||||||
|
# cached
|
||||||
|
Δ = loadLaplacian(prepath(sett), parent(sett.S[1]))
|
||||||
|
else
|
||||||
|
# compute
|
||||||
|
Δ = computeLaplacian(sett.S, sett.radius)
|
||||||
|
save(filename(prepath(sett), :pm), "pm", parent(Δ).pm)
|
||||||
|
save(filename(prepath(sett), :Δ), "Δ", Δ.coeffs)
|
||||||
|
end
|
||||||
|
|
||||||
|
files_exist = ex.([:Uπs, :orbits, :preps])
|
||||||
|
|
||||||
if !all(files_exists)
|
if !all(files_exists)
|
||||||
compute_orbit_data(prepath(sett), sett.S, sett.autS, radius=sett.radius)
|
compute_orbit_data(prepath(sett), sett.S, sett.autS, radius=sett.radius)
|
||||||
|
@ -129,43 +129,21 @@ function orthSVD{T}(M::AbstractMatrix{T})
|
|||||||
return fact[:U][:,1:M_rank]
|
return fact[:U][:,1:M_rank]
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_orbit_data{T<:GroupElem}(name::String, S::Vector{T}, autS::Group; radius=2)
|
function compute_orbit_data(name::String, RG::GroupRing, autS::Group)
|
||||||
isdir(name) || mkdir(name)
|
|
||||||
|
|
||||||
info("Generating ball of radius $(2*radius)")
|
|
||||||
|
|
||||||
# TODO: Fix that by multiple dispatch?
|
|
||||||
G = parent(first(S))
|
|
||||||
Id = (isa(G, Ring) ? one(G) : G())
|
|
||||||
|
|
||||||
@time E_2R, sizes = Groups.generate_balls(S, Id, radius=2*radius);
|
|
||||||
info("Balls of sizes $sizes.")
|
|
||||||
info("Reverse dict")
|
|
||||||
@time E_rdict = GroupRings.reverse_dict(E_2R)
|
|
||||||
|
|
||||||
info("Product matrix")
|
|
||||||
@time pm = GroupRings.create_pm(E_2R, E_rdict, sizes[radius], twisted=true)
|
|
||||||
RG = GroupRing(G, E_2R, E_rdict, pm)
|
|
||||||
Δ = PropertyT.spLaplacian(RG, S)
|
|
||||||
@assert GroupRings.aug(Δ) == 0
|
|
||||||
save(filename(name, :Δ), "Δ", Δ.coeffs)
|
|
||||||
save(filename(name, :pm), "pm", pm)
|
|
||||||
|
|
||||||
info("Decomposing E into orbits of $(autS)")
|
info("Decomposing E into orbits of $(autS)")
|
||||||
@time orbs = orbit_decomposition(autS, E_2R, E_rdict)
|
@time orbs = orbit_decomposition(autS, RG.basis, RG.basis_dict)
|
||||||
@assert sum(length(o) for o in orbs) == length(E_2R)
|
@assert sum(length(o) for o in orbs) == length(RG.basis)
|
||||||
info("E consists of $(length(orbs)) orbits!")
|
info("E consists of $(length(orbs)) orbits!")
|
||||||
save(joinpath(name, "orbits.jld"), "orbits", orbs)
|
|
||||||
|
|
||||||
info("Action matrices")
|
info("Action matrices")
|
||||||
@time reps = perm_reps(autS, E_2R[1:sizes[radius]], E_rdict)
|
@time preps = perm_reps(autS, RG.basis[1:size(RG.pm,1)], RG.basis_dict)
|
||||||
save_preps(filename(name, :preps), reps)
|
mreps = matrix_reps(preps)
|
||||||
reps = matrix_reps(reps)
|
|
||||||
|
|
||||||
info("Projections")
|
info("Projections")
|
||||||
@time autS_mps = Projections.rankOne_projections(GroupRing(autS));
|
@time autS_mps = Projections.rankOne_projections(GroupRing(autS));
|
||||||
|
|
||||||
@time π_E_projections = [Cstar_repr(p, reps) for p in autS_mps]
|
@time π_E_projections = [Cstar_repr(p, mreps) for p in autS_mps]
|
||||||
|
|
||||||
info("Uπs...")
|
info("Uπs...")
|
||||||
@time Uπs = orthSVD.(π_E_projections)
|
@time Uπs = orthSVD.(π_E_projections)
|
||||||
@ -174,10 +152,10 @@ function compute_orbit_data{T<:GroupElem}(name::String, S::Vector{T}, autS::Grou
|
|||||||
info("multiplicities = $multiplicities")
|
info("multiplicities = $multiplicities")
|
||||||
dimensions = [Int(p[autS()]*Int(order(autS))) for p in autS_mps];
|
dimensions = [Int(p[autS()]*Int(order(autS))) for p in autS_mps];
|
||||||
info("dimensions = $dimensions")
|
info("dimensions = $dimensions")
|
||||||
@assert dot(multiplicities, dimensions) == sizes[radius]
|
@assert dot(multiplicities, dimensions) == size(RG.pm,1)
|
||||||
|
|
||||||
save(joinpath(name, "U_pis.jld"),
|
save(filename(name, :orbits), "orbits", orbs)
|
||||||
"Uπs", Uπs,
|
save_preps(filename(name, :preps), preps)
|
||||||
"dims", dimensions)
|
save(filename(name, :Uπs), "Uπs", Uπs, "dims", dimensions)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user