From 3df3967fad58cd208f1088bbe07e2f036e21f8ce Mon Sep 17 00:00:00 2001 From: kalmarek Date: Sun, 16 Sep 2018 18:02:35 +0200 Subject: [PATCH] add generic saveGRElem, loadGRElem --- src/laplacians.jl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/laplacians.jl b/src/laplacians.jl index 1b00da0..2d73c58 100644 --- a/src/laplacians.jl +++ b/src/laplacians.jl @@ -45,13 +45,19 @@ function Laplacian(S, Id, radius) return Δ end -function loadLaplacian(name::String, G::Group) - if exists(filename(name, :Δ)) && exists(filename(name, :pm)) +function saveGRElem(filename::String, g::GroupRingElem) + RG = parent(g) + JLD.save(filename, "coeffs", g.coeffs, "pm", RG.pm, "G", RG.group) +end + +function loadGRElem(fname::String, G::Group) + if isfile(fname) info("Loading precomputed Δ...") - RG = GroupRing(G, load(filename(name, :pm), "pm")) - Δ = GroupRingElem(load(filename(name, :Δ), "Δ")[:, 1], RG) + coeffs, pm = load(fname, "coeffs", "pm") + RG = GroupRing(G, pm) + Δ = GroupRingElem(coeffs, RG) else - throw("You need to precompute $(filename(name, :pm)) and $(filename(name, :Δ)) to load it!") + throw(ErrorException("You need to precompute $fname first!")) end return Δ end