@@ -198,3 +198,29 @@ Base.@propagate_inbounds _deepview_impl(A::AbstractArray{<:AbstractArray}, idxs_
198
198
_deepview_tupled .(view (A, idxs_outer... ), (idxs_inner,))
199
199
200
200
Base. @propagate_inbounds _deepview_tupled (A:: AbstractArray , idxs:: Tuple ) = deepview (A, idxs... )
201
+
202
+
203
+ """
204
+ abstract_nestedarray_type(T_inner::Type, ::Val{ndims_tuple})
205
+
206
+ Return the type of nested `AbstractArray`s. `T_inner` specifies the element
207
+ type of the innermost layer of arrays, `ndims_tuple` specifies the
208
+ dimensionality of each nesting layer (outer arrays first).
209
+
210
+ If `ndims_tuple` is empty, the returns is the (typically scalar) type
211
+ `T_inner` itself.
212
+ """
213
+ function abstract_nestedarray_type end
214
+ export abstract_nestedarray_type
215
+
216
+
217
+ Base. @pure function abstract_nestedarray_type (:: Type{T_inner} , outer:: Val{ndims_tuple} ) where {T_inner,ndims_tuple}
218
+ _abstract_nestedarray_type_impl (T_inner, ndims_tuple... )
219
+ end
220
+
221
+ Base. @pure _abstract_nestedarray_type_impl (:: Type{T_inner} ) where {T_inner} = T_inner
222
+
223
+ Base. @pure _abstract_nestedarray_type_impl (:: Type{T_inner} , N) where {T_inner} = AbstractArray{T_inner, N}
224
+
225
+ Base. @pure _abstract_nestedarray_type_impl (:: Type{T_inner} , N, M, ndims_tuple... ) where {T_inner} =
226
+ AbstractArray{<: _abstract_nestedarray_type_impl (T_inner, M, ndims_tuple... ), N}
0 commit comments