@@ -12,6 +12,11 @@ created from a timeseries `s` with `T` type numbers.
1212
1313Use `Reconstruction(s::AbstractVector{T}, D, τ)` to create an instance.
1414
15+ Use `Reconstruction(s::SizedAray{S1, S2}, D, τ)` to create a reconstruction using
16+ a multi-dimensional timeseries. Note that a reconstruction created this way will
17+ have `S2*D` total dimensions and *not* `D`, as a result of each dimension of
18+ `s` having `D` delayed dimensions.
19+
1520## Description
1621The ``n``th row of a `Reconstruction` is the `D`-dimensional vector
1722```math
4853Reconstruction (s:: AbstractVector{T} , D, τ) where {T} =
4954Reconstruction {D, T, τ} (reconstruct (s, Val {D} (), τ))
5055
56+ Reconstruction (s:: SizedArray{Tuple{S1, S2}, T, 2, M} , D, τ) where {S1, S2, T, M} =
57+ Reconstruction {S2*D, T, τ} (reconstruct (s, Val {D} (), τ))
58+
5159@inline delay (:: Reconstruction{D, T, t} ) where {T,D,t} = t
5260
5361function reconstruct_impl (:: Type{Val{D}} ) where D
@@ -66,10 +74,29 @@ function reconstruct_impl(::Type{Val{D}}) where D
6674 end
6775end
6876
77+ function reconstructmat_impl (:: Type{Val{S2}} , :: Type{Val{D}} ) where {S2, D}
78+ gens = [:(s[i + $ k* τ, $ d]) for k= 0 : D- 1 for d= 1 : S2]
79+
80+ quote
81+ L = size (s,1 ) - ($ (D- 1 ))* τ;
82+ T = eltype (s)
83+ data = Vector {SVector{$D*$S2, T}} (L)
84+ for i in 1 : L
85+ data[i] = SVector {$D*$S2,T} ($ (gens... ))
86+ end
87+ V = typeof (s)
88+ T = eltype (s)
89+ data
90+ end
91+ end
92+
6993@generated function reconstruct (s:: AbstractVector{T} , :: Val{D} , τ) where {D, T}
7094 reconstruct_impl (Val{D})
7195end
7296
97+ @generated function reconstruct (s:: SizedArray{Tuple{S1, S2}, T, 2, M} , :: Val{D} , τ) where {S1, S2, T, M, D}
98+ reconstructmat_impl (Val{S2}, Val{D})
99+ end
73100
74101# Pretty print:
75102matname (d:: Reconstruction{D, T, τ} ) where {D, T, τ} =
0 commit comments