1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-03 17:56:28 +01:00

generate_balls for RingElem

This commit is contained in:
kalmarek 2017-11-08 11:09:29 +01:00
parent 99c07c6909
commit 36279d2601

View File

@ -390,6 +390,17 @@ function generate_balls{T<:GroupElem}(S::Vector{T}, Id::T=parent(first(S))(); ra
return B, sizes
end
function generate_balls{T<:RingElem}(S::Vector{T}, Id::T=one(parent(first(S))); radius=2, op=*)
sizes = Int[]
B = [Id]
for i in 1:radius
BB = [op(i,j) for (i,j) in Base.product(B,S)]
B = unique([B; vec(BB)])
push!(sizes, length(B))
end
return B, sizes
end
###############################################################################
#
# Includes