@@ -154,21 +154,32 @@ function ComponentArrayInterpreter(vc::CA.AbstractComponentArray)
154154 ComponentArrayInterpreter (CA. getaxes (vc))
155155end
156156
157+ const CAorCAI = Union{CA. AbstractComponentArray, AbstractComponentArrayInterpreter}
158+
157159# Attach axes to matrices and arrays of ComponentArrays
158160# with ComponentArrays in the first dimensions (e.g. rownames of a matrix or array)
159- function ComponentArrayInterpreter (
160- ca:: CA.AbstractComponentArray , n_dims:: NTuple{N,<:Integer} ) where {N}
161+ function ComponentArrayInterpreter (ca:: CAorCAI , n_dims:: NTuple{N,<:Integer} ) where {N}
161162 ComponentArrayInterpreter ((), CA. getaxes (ca), n_dims)
162163end
164+ # with ComponentArrays in the last dimensions (e.g. columnnames of a matrix)
165+ function ComponentArrayInterpreter (n_dims:: NTuple{N,<:Integer} , ca:: CAorCAI ) where {N}
166+ ComponentArrayInterpreter (n_dims, CA. getaxes (ca), ())
167+ end
168+ # with ComponentArrays in the center dimensions (e.g. columnnames of a 3D-array)
163169function ComponentArrayInterpreter (
164- cai:: AbstractComponentArrayInterpreter , n_dims:: NTuple{N,<:Integer} ) where {N}
165- ComponentArrayInterpreter ((), CA. getaxes (cai), n_dims)
170+ n_dims:: NTuple{N,<:Integer} , ca:: CAorCAI , m_dims:: NTuple{M,<:Integer} ) where {N,M}
171+ ComponentArrayInterpreter (n_dims, CA. getaxes (ca), m_dims)
172+ end
173+
174+ function ComponentArrayInterpreter (
175+ n_dims:: NTuple{N,<:Integer} , axes:: NTuple{A,<:CA.AbstractAxis} ,
176+ m_dims:: NTuple{M,<:Integer} ) where {N,A,M}
177+ axes_ext = (
178+ map (n_dim -> CA. Axis (i= 1 : n_dim), n_dims)... ,
179+ axes... ,
180+ map (n_dim -> CA. Axis (i= 1 : n_dim), m_dims)... )
181+ ComponentArrayInterpreter (axes_ext)
166182end
167- # function ComponentArrayInterpreter(
168- # axes::NTuple{M,<:CA.AbstractAxis}, n_dims::NTuple{N,<:Integer}) where {M,N}
169- # axes_ext = (axes..., map(n_dim -> CA.Axis(i=1:n_dim), n_dims)...)
170- # ComponentArrayInterpreter(axes_ext)
171- # end
172183
173184# support also for other AbstractComponentArrayInterpreter types
174185# in a type-stable way by providing the Tuple of dimensions as a value type
@@ -184,48 +195,11 @@ function stack_ca_int(
184195 IT. name. wrapper (CA. getaxes (cai), n_dims):: IT.name.wrapper
185196end
186197function StaticComponentArrayInterpreter (
187- axes:: NTuple{M ,<:CA.AbstractAxis} , n_dims:: NTuple{N,<:Integer} ) where {M ,N}
198+ axes:: NTuple{A ,<:CA.AbstractAxis} , n_dims:: NTuple{N,<:Integer} ) where {A ,N}
188199 axes_ext = (axes... , map (n_dim -> CA. Axis (i= 1 : n_dim), n_dims)... )
189200 StaticComponentArrayInterpreter {axes_ext} ()
190201end
191202
192- # with ComponentArrays in the last dimensions (e.g. columnnames of a matrix)
193- function ComponentArrayInterpreter (
194- n_dims:: NTuple{N,<:Integer} , ca:: CA.AbstractComponentArray ) where {N}
195- ComponentArrayInterpreter (n_dims, CA. getaxes (ca), ())
196- end
197- function ComponentArrayInterpreter (
198- n_dims:: NTuple{N,<:Integer} , cai:: AbstractComponentArrayInterpreter ) where {N}
199- ComponentArrayInterpreter (n_dims, CA. getaxes (cai), ())
200- end
201- # function ComponentArrayInterpreter(
202- # n_dims::NTuple{N,<:Integer}, axes::NTuple{M,<:CA.AbstractAxis}) where {N,M}
203- # axes_ext = (map(n_dim -> CA.Axis(i=1:n_dim), n_dims)..., axes...)
204- # ComponentArrayInterpreter(axes_ext)
205- # end
206-
207- # with ComponentArrays in the center dimensions (e.g. columnnames of a 3D-array)
208- function ComponentArrayInterpreter (
209- n_dims:: NTuple{N,<:Integer} , ca:: CA.AbstractComponentArray ,
210- m_dims:: NTuple{M,<:Integer} ) where {N,M}
211- ComponentArrayInterpreter (n_dims, CA. getaxes (ca), m_dims)
212- end
213- function ComponentArrayInterpreter (
214- n_dims:: NTuple{N,<:Integer} , cai:: AbstractComponentArrayInterpreter ,
215- m_dims:: NTuple{M,<:Integer} ) where {N,M}
216- ComponentArrayInterpreter (n_dims, CA. getaxes (cai), m_dims)
217- end
218-
219- function ComponentArrayInterpreter (
220- n_dims:: NTuple{N,<:Integer} , axes:: NTuple{A,<:CA.AbstractAxis} ,
221- m_dims:: NTuple{M,<:Integer} ) where {N,A,M}
222- axes_ext = (
223- map (n_dim -> CA. Axis (i= 1 : n_dim), n_dims)... ,
224- axes... ,
225- map (n_dim -> CA. Axis (i= 1 : n_dim), m_dims)... )
226- ComponentArrayInterpreter (axes_ext)
227- end
228-
229203
230204function stack_ca_int (
231205 :: Val{n_dims} , cai:: IT ) where {IT<: AbstractComponentArrayInterpreter ,n_dims}
0 commit comments