mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2025-01-12 22:22:32 +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
|
(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)
|
||||||
|
@ -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")
|
||||||
|
Loading…
Reference in New Issue
Block a user