From fc4b01a1930fabe90fed4dee698ff8df66c24396 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Sun, 30 Jun 2019 19:55:56 +0200 Subject: [PATCH] broaden signature of generate_balls to include NCRingElems --- src/Groups.jl | 6 ++++-- test/runtests.jl | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Groups.jl b/src/Groups.jl index a038e99..909473c 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -425,7 +425,8 @@ end # ############################################################################### -function generate_balls(S::Vector{T}, Id::T=parent(first(S))(); radius=2, op=*) where T<:GroupElem +function generate_balls(S::AbstractVector{T}, Id::T=parent(first(S))(); + radius=2, op=*) where T<:GroupElem sizes = Int[] B = [Id] for i in 1:radius @@ -436,7 +437,8 @@ function generate_balls(S::Vector{T}, Id::T=parent(first(S))(); radius=2, op=*) return B, sizes end -function generate_balls(S::Vector{T}, Id::T=one(parent(first(S))); radius=2, op=*) where {T<:RingElem} +function generate_balls(S::AbstractVector{T}, Id::T=one(parent(first(S))); + radius=2, op=*) where {T<:NCRingElem} sizes = Int[] B = [Id] for i in 1:radius diff --git a/test/runtests.jl b/test/runtests.jl index 8364bf0..6f55d86 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,18 @@ using Groups using LinearAlgebra @testset "Groups" begin + + @testset "generate balls" begin + M = MatrixAlgebra(zz, 3) + w = one(M); w[1,2] = 1; + r = one(M); r[2,3] = -3; + s = one(M); s[1,3] = 2; s[3,2] = -1; + + S = [w,r,s]; S = unique([S; inv.(S)]); + _, sizes = Groups.generate_balls(S, radius=4); + @test sizes == [7, 33, 141, 561] + end + include("FreeGroup-tests.jl") include("AutGroup-tests.jl") include("DirectPower-tests.jl")