@@ -27,6 +27,12 @@ Additionally, the `convert(Array,VA::AbstractVectorOfArray)` function is provide
2727the `VectorOfArray` into a matrix/tensor. Also, `vecarr_to_vectors(VA::AbstractVectorOfArray)`
2828returns a vector of the series for each component, that is, `A[i,:]` for each `i`.
2929A plot recipe is provided, which plots the `A[i,:]` series.
30+
31+ There is also support for `VectorOfArray` with constructed from multi-dimensional arrays
32+ ```julia
33+ VectorOfArray(u::AbstractArray{AT}) where {T, N, AT <: AbstractArray{T, N}}
34+ ```
35+ where `IndexStyle(typeof(u)) isa IndexLinear`.
3036"""
3137mutable struct VectorOfArray{T, N, A} <: AbstractVectorOfArray{T, N, A}
3238 u:: A # A <: AbstractVector{<: AbstractArray{T, N - 1}}
@@ -150,6 +156,13 @@ function VectorOfArray(vec::AbstractVector{VT}) where {T, N, VT <: AbstractArray
150156 VectorOfArray {T, N + 1, typeof(vec)} (vec)
151157end
152158
159+ # allow multi-dimensional arrays as long as they're linearly indexed
160+ function VectorOfArray (array:: AbstractArray{AT} ) where {T, N, AT <: AbstractArray{T, N} }
161+ @assert IndexStyle (typeof (array)) isa IndexLinear
162+
163+ return VectorOfArray {T, N + 1, typeof(array)} (array)
164+ end
165+
153166function DiffEqArray (vec:: AbstractVector{T} ,
154167 ts:: AbstractVector ,
155168 :: NTuple{N, Int} ,
0 commit comments