Skip to content

Commit

Permalink
Make GroupElem broadcastable (#1714)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored May 24, 2024
1 parent 86b9cfd commit bb1d1eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,11 @@ function comm!(out::T, g::T, h::T) where {T<:GroupElem}
tmp = (out === g) ? conj(g, h) : conj!(out, g, h)
return div_left!(out, tmp, g)
end

###############################################################################
#
# Scalar for broadcasting
#
###############################################################################

Base.broadcastable(x::GroupElem) = Ref(x)
8 changes: 8 additions & 0 deletions test/Groups-conformance-tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,13 @@ function test_GroupElem_interface(g::GEl, h::GEl) where {GEl<:GroupElem}
g = deepcopy(old_g)
end
end

@testset "Broadcasting" begin
@test g .* [g, h] == [g * g, g * h]
G = parent(g)
if has_gens(G)
@test g .* gens(G) == [g * x for x in gens(G)]
end
end
end
end

0 comments on commit bb1d1eb

Please sign in to comment.