fix error in wlmetric_ball_serial

This commit is contained in:
kalmarek 2020-10-09 17:37:57 +02:00
parent 6e856dd7c2
commit 59272b3b42
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 3 additions and 5 deletions

View File

@ -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 (by default: the identity element). `radius` and `op` keywords specify the
radius and multiplication operation to be used. radius and multiplication operation to be used.
""" """
function wlmetric_ball_serial( function wlmetric_ball_serial(
S::AbstractVector{T}; S::AbstractVector{T};
radius = 2, radius = 2,
@ -81,10 +80,7 @@ function wlmetric_ball_serial(
old = unique!([one(first(S)), S...]) old = unique!([one(first(S)), S...])
sizes = [1, length(old)] sizes = [1, length(old)]
for i = 2:radius for i = 2:radius
new = collect( new = collect(op(o, s) for o in @view(old[sizes[end-1]:end]) for s in S)
op(i, j)
for (i, j) in Base.product(@view(old[sizes[end-1]:end]), S)
)
append!(old, new) append!(old, new)
resize!(new, 0) resize!(new, 0)
old = unique!(old) old = unique!(old)

View File

@ -15,6 +15,8 @@ using LinearAlgebra
S = [w,r,s]; S = unique([S; inv.(S)]); S = [w,r,s]; S = unique([S; inv.(S)]);
_, sizes = Groups.wlmetric_ball(S, radius=4); _, sizes = Groups.wlmetric_ball(S, radius=4);
@test sizes == [7, 33, 141, 561] @test sizes == [7, 33, 141, 561]
_, sizes = Groups.wlmetric_ball_serial(S, radius=4);
@test sizes == [7, 33, 141, 561]
end end
include("FreeGroup-tests.jl") include("FreeGroup-tests.jl")