diff --git a/src/1712.07167.jl b/src/1712.07167.jl index e02a2fd..cbe5dd8 100644 --- a/src/1712.07167.jl +++ b/src/1712.07167.jl @@ -207,11 +207,12 @@ function check_property_T(sett::Settings) if isfile(filename(sett,:Δ)) # cached - Δ = loadLaplacian(filename(sett,:Δ), sett.G) + @info("Loading precomputed Δ...") + Δ = loadGRElem(filename(sett,:Δ), sett.G) else # compute Δ = Laplacian(sett.S, sett.radius) - saveLaplacian(filename(sett, :Δ), Δ) + saveGRElem(filename(sett, :Δ), Δ) end if !sett.warmstart && isfile(filename(sett, :solution)) diff --git a/src/laplacians.jl b/src/laplacians.jl index eacb8aa..f9bc2e9 100644 --- a/src/laplacians.jl +++ b/src/laplacians.jl @@ -45,19 +45,24 @@ function Laplacian(S, Id, radius) return Δ end -function saveGRElem(filename::String, g::GroupRingElem) +function saveGRElem(fname::String, g::GroupRingElem) RG = parent(g) - JLD.save(filename, "coeffs", g.coeffs, "pm", RG.pm, "G", RG.group) + JLD.save(fname, "coeffs", g.coeffs, "pm", RG.pm, "G", RG.group) +end + +function loadGRElem(fname::String, RG::GroupRing) + coeffs = load(fname, "coeffs") + return GroupRingElem(coeffs, RG) end function loadGRElem(fname::String, G::Group) - if isfile(fname) - @info("Loading precomputed Δ...") - coeffs, pm = load(fname, "coeffs", "pm") - RG = GroupRing(G, pm) - Δ = GroupRingElem(coeffs, RG) - else - throw(ErrorException("You need to precompute $fname first!")) - end - return Δ + pm = load(fname, "pm") + RG = GroupRing(G, pm) + return loadGRElem(fname, RG) +end + +function loadGRElem(fname::String) + pm, G = load(fname, "pm", "G") + RG = GroupRing(G, pm) + return loadGRElem(fname, RG) end