xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.33k stars 398 forks source link

xview_stepper implementation #699

Closed JohanMabille closed 6 years ago

JohanMabille commented 6 years ago

The current implementation of xview_stepper assumes a uniform step_size per slice, and adds it to the underlying iterator when stepping. This is somehow equivalent to a strided view.

However, if we want to implement slices such as "contains indices" or "drop indices" (i.e. slices that check that the given index is or is not in a given list), this implementation needs to be improved. For now, the only solution I see is to add a parameter to the step_size method of the slices, this parameter being the current index in the given dimension.

That implies tracking the full index in the stepper view (meaning additional memory allocation) and thus I wonder if going for an xindex_stepper could be more efficient.

wolfv commented 6 years ago

I am closing this issue as we've implemented this for the new islice