From 5414988e98e3b740458118bbbe384efe3eb040b2 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 12 Mar 2020 00:18:33 -0500 Subject: [PATCH] periodically reduce words in automorphism evaluation to avoid exponential explosion in length (when possible) --- src/AutGroup.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AutGroup.jl b/src/AutGroup.jl index 20ef578..939b837 100644 --- a/src/AutGroup.jl +++ b/src/AutGroup.jl @@ -150,7 +150,7 @@ end function domain(G::AutGroup{N}) where N F = G.objectGroup gg = gens(F) - return ntuple(i->gg[i], Val(N)) + return ntuple(i->gg[i], N) end ############################################################################### @@ -223,8 +223,9 @@ function (f::AutSymbol)(v::NTuple{N, T}) where {N, T} end function (F::Automorphism{N})(v::NTuple{N, T}) where {N, T} - for f in F.symbols + for (i, f) in enumerate(F.symbols) v = f(v)::NTuple{N, T} + i % 5 == 0 && reduce!.(v) end return v end @@ -248,7 +249,7 @@ function hash(g::Automorphism, h::UInt) g_im = reduce!.(g(domain(parent(g)))) g.savedhash = hash(g, g_im) g.modified = false - end + end return xor(g.savedhash, h) end