mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 18:15:29 +01:00
fix error in wlmetric_ball_serial
This commit is contained in:
parent
6e856dd7c2
commit
59272b3b42
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user