Skip to content

Commit 83bb54f

Browse files
feat: add ndims method for ::Type{<:AbstractVectorOfArray}
1 parent 805a1cd commit 83bb54f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/vector_of_array.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ function Base.check_parent_index_match(
609609
nothing
610610
end
611611
Base.ndims(::AbstractVectorOfArray{T, N}) where {T, N} = N
612+
Base.ndims(::Type{<:AbstractVectorOfArray{T, N}}) where {T, N} = N
612613

613614
function Base.checkbounds(
614615
::Type{Bool}, VA::AbstractVectorOfArray{T, N, <:AbstractVector{T}},

test/interface_tests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ push!(testda, [-1, -2, -3, -4])
5050
@test testda[:, 9] == [-1, -2, -3, -4]
5151
@test testda[:, end] == [-1, -2, -3, -4]
5252

53+
# ndims
54+
@test ndims(testva) == 2
55+
@test ndims(typeof(testva)) == 2
56+
5357
# Currently we enforce the general shape, they can just be different lengths, ie we
5458
# can't do
5559
# Decide if this is desired, or remove this restriction

0 commit comments

Comments
 (0)