AbstractVector interface for DirectProductGroupElem

This commit is contained in:
kalmar 2017-07-12 21:10:01 +02:00
parent 799878ded5
commit a3eeee0728
1 changed files with 13 additions and 1 deletions

View File

@ -36,12 +36,24 @@ parent(g::DirectProductGroupElem) = DirectProductGroup([parent(h) for h in g.elt
###############################################################################
#
# DirectProductGroup / DirectProductGroupElem constructors
# AbstractVector interface
#
###############################################################################
Base.size(g::DirectProductGroupElem) = size(g.elts)
Base.linearindexing(::Type{DirectProductGroupElem}) = Base.LinearFast()
Base.getindex(g::DirectProductGroupElem, i::Int) = g.elts[i]
function Base.setindex!{T<:GroupElem}(g::DirectProductGroupElem{T}, v::T, i::Int)
p.part[i] = v
return p
end
###############################################################################
#
# DirectProductGroup / DirectProductGroupElem constructors
#
###############################################################################
DirectProductGroup{T<:Group}(G::T, H::T) = DirectProductGroup{T}([G, H])
×(G::Group, H::Group) = DirectProductGroup([G,H])