This PR implements indexing and slicing functionality to Tensor class. Following Array API standard, indexing can be performed with: ints a[1, 3], slices a[:, 1:10:2], ellipsis a[8, ...], and arrays/lists a[:, [1,1,2]]. Missing dims are expanded to :, so for 3-D array, array[4] is equal to array[4, :, :].
AFAIK Julia doesn't support Ellipsis, so I implemented expanding it to slices here. Also, Finch Tensor accepts ranges instead of slices, so I convert slice(...) to jl.range(...).
Hi @willow-ahrens @hameerabbasi,
This PR implements indexing and slicing functionality to
Tensor
class. Following Array API standard, indexing can be performed with: intsa[1, 3]
, slicesa[:, 1:10:2]
, ellipsisa[8, ...]
, and arrays/listsa[:, [1,1,2]]
. Missing dims are expanded to:
, so for 3-D array,array[4]
is equal toarray[4, :, :]
.AFAIK Julia doesn't support Ellipsis, so I implemented expanding it to slices here. Also, Finch Tensor accepts ranges instead of slices, so I convert
slice(...)
tojl.range(...)
.For 1-D tests to pass https://github.com/willow-ahrens/Finch.jl/issues/427 needs to be solved first.