From 59272b3b42636ea0ad02843a12b40be4016ebac9 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Fri, 9 Oct 2020 17:37:57 +0200 Subject: [PATCH] fix error in wlmetric_ball_serial --- src/Groups.jl | 6 +----- test/runtests.jl | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Groups.jl b/src/Groups.jl index 1c2cb9c..7d2d607 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -72,7 +72,6 @@ word-length metric on the group generated by `S`. The ball is centered at `cente (by default: the identity element). `radius` and `op` keywords specify the radius and multiplication operation to be used. """ - function wlmetric_ball_serial( S::AbstractVector{T}; radius = 2, @@ -81,10 +80,7 @@ function wlmetric_ball_serial( old = unique!([one(first(S)), S...]) sizes = [1, length(old)] for i = 2:radius - new = collect( - op(i, j) - for (i, j) in Base.product(@view(old[sizes[end-1]:end]), S) - ) + new = collect(op(o, s) for o in @view(old[sizes[end-1]:end]) for s in S) append!(old, new) resize!(new, 0) old = unique!(old) diff --git a/test/runtests.jl b/test/runtests.jl index 0ac1db5..077c3b3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,8 @@ using LinearAlgebra S = [w,r,s]; S = unique([S; inv.(S)]); _, sizes = Groups.wlmetric_ball(S, radius=4); @test sizes == [7, 33, 141, 561] + _, sizes = Groups.wlmetric_ball_serial(S, radius=4); + @test sizes == [7, 33, 141, 561] end include("FreeGroup-tests.jl")