Open kitsing opened 5 years ago
Notes here from @kitsing :
NumPy-style advanced indexing has form A[X1, X2, ..., Xk]
, where
A
has k
dims, here in Nexus typed with axes-descriptor (A1, A2, ..., Ak)
k
indexers X1
, ..., Xk
, each must be of any of the 3 following forms:
Int
index: e.g. 2
;:
/ 1:
, :4
;(B1, B2, ..., Bm)
.@kitsing pointed out that advanced indexing is valid if and only if all indexers X1
, ..., Xk
can be promoted/broadcasted to the same shape (or in Nexus, same axes-type):
Int
index is assumed to be of type ()
;i
-th position of the indexee A
is assumed to be of type (Ai, )
;Hence we have
def advIdx[T[_], U, Vs]
(indexee: T[U])(indexers: Vs)(implicit v: BroadcastN.Aux[Vs, V]): T[V]
// Vs is an HList of type descriptors
// e.g.
advIdx(T[(α, β, γ)])(T[(α)], T[(δ)], ?): T[(α, δ, γ)]
Would be nice if it is possible to index tensors with other index-typed tensors.