diff --git a/src/DirectProducts.jl b/src/DirectProducts.jl index b0084b9..dce8f4b 100644 --- a/src/DirectProducts.jl +++ b/src/DirectProducts.jl @@ -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])