Skip to content

Commit 8ff23fb

Browse files
author
Michael Abbott
committed
tuples of named arrays
1 parent ebd9c16 commit 8ff23fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/LazyStack.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ getnames(xs::AbstractArray{<:AbstractArray}) =
301301

302302
# tuple of arrays
303303
stack(x::AT) where {AT <: Tuple{Vararg{NamedDimsArray{L,T,IN}}}} where {T,IN,L} =
304-
ensure_named(Stacked{T, IN+1, AT}(x), getnames(x))
304+
ensure_named(stack(map(parent,x)), getnames(x))
305305

306306
getnames(xs::Tuple{Vararg{<:NamedDimsArray}}) =
307307
(dimnames(first(xs))..., :_)

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ end
9999

100100
nin = [NamedDimsArray(ones(3), :a) for i in 1:4]
101101
@test dimnames(stack(nin)) == (:a, :_)
102+
@test dimnames(stack(nin...)) == (:a, :_)
102103
@test dimnames(stack(:b, nin)) == (:a, :b)
104+
@test dimnames(stack(:b, nin...)) == (:a, :b)
105+
@test stack(nin).data.slices[1] isa NamedDimsArray # vector container untouched,
106+
@test stack(nin...).data.slices[1] isa Array # but tuple container cleaned up.
103107

104108
nout = NamedDimsArray([ones(3) for i in 1:4], :b)
105109
@test dimnames(stack(nout)) == (:_, :b)

0 commit comments

Comments
 (0)