xtensor
xtensor copied to clipboard
xt::drop doesn't work when indices are out of order
Environment:
xtensor: 0.21.5 compiler: gcc 12.2.1 OS: Fedora 36
Problem:
Given the following code:
xt::xtensor<double, 1> vec1{0,1,2,3,4,5};
xt::xtensor<double, 1> vec2 = view(vec1, xt::drop(2,0));
I would expect vec2 to contain {1,3,4,5}, but it contains {2,3,3,4}. I can see why it might be UB to pass indices to xt::drop (and maybe also xt::keep) out of order, but I don't see anywhere in the docs that claims this is the case.
Either the docs need to be updated or this is a bug that needs to be fixed.
I guess it could just be due to my obsolete xtensor version. Don't have an easy way to test on 0.24.3 but will try and test when possible.