save GAP output to GAP.log

This commit is contained in:
kalmarek 2018-01-04 10:46:40 +01:00
parent 86cadd0440
commit 122ebe92bf

View File

@ -2,9 +2,11 @@ using JLD
function GAP_code(group_code, dir, R; maxeqns=10_000, infolevel=2)
code = """
LogTo("$(dir)/GAP.log");
RequirePackage("kbmag");
SetInfoLevel(InfoRWS, $infolevel);
MetricBalls := function(rws, R)
local l, basis, sizes, i;
l := EnumerateReducedWords(rws, 0, R);;
@ -53,7 +55,7 @@ end;;
$group_code
G:= SimplifiedFpGroup(G);
# G:= SimplifiedFpGroup(G);
RWS := KBMAGRewritingSystem(G);
# ResetRewritingSystem(RWS);
O:=OptionsRecordOfKBMAGRewritingSystem(RWS);;
@ -70,7 +72,7 @@ t := Runtime();
res := MetricBalls(RWS,$(2*R));;
Print("Metric-Balls generation: \t", StringTime(Runtime()-t), "\\n");
B := res[1];; sizes := res[2];;
Print(sizes, "\\n");
Print("Sizes of generated Balls: \t", sizes, "\\n");
t := Runtime();
pm := ProductMatrix(RWS, B, sizes[$R]);;
@ -96,7 +98,7 @@ function GAP_groupcode(S, rels)
code = """
F := $F;
AssignGeneratorVariables(F);;
relations := $rels;
relations := $rels;;
G := F/relations;
"""
return code
@ -111,14 +113,13 @@ function GAP_execute(gap_code, dir)
open(GAP_file, "w") do io
write(io, gap_code)
end
run(`gap -q $(GAP_file)`)
run(pipeline(`cat $(GAP_file)`, `gap -q`))
end
function prepare_pm_delta_csv(name, group_code, R; maxeqns=10_000, infolevel=2)
info("Preparing multiplication table using GAP (via kbmag)")
gap_code = GAP_code(group_code, name, R, maxeqns=maxeqns, infolevel=infolevel)
o = GAP_execute(gap_code, name)
return o
GAP_execute(gap_code, name)
end
function prepare_pm_delta(name, group_code, R; maxeqns=100_000, infolevel=2)