@@ -27,6 +27,12 @@ Additionally, the `convert(Array,VA::AbstractVectorOfArray)` function is provide
27
27
the `VectorOfArray` into a matrix/tensor. Also, `vecarr_to_vectors(VA::AbstractVectorOfArray)`
28
28
returns a vector of the series for each component, that is, `A[i,:]` for each `i`.
29
29
A 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`.
30
36
"""
31
37
mutable struct VectorOfArray{T, N, A} <: AbstractVectorOfArray{T, N, A}
32
38
u:: A # A <: AbstractVector{<: AbstractArray{T, N - 1}}
@@ -150,6 +156,13 @@ function VectorOfArray(vec::AbstractVector{VT}) where {T, N, VT <: AbstractArray
150
156
VectorOfArray {T, N + 1, typeof(vec)} (vec)
151
157
end
152
158
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
+
153
166
function DiffEqArray (vec:: AbstractVector{T} ,
154
167
ts:: AbstractVector ,
155
168
:: NTuple{N, Int} ,
0 commit comments