Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uplack of functionality in "unravel" function #1792
Open
Labels
Comments
also there's nothing about unravel in the docs |
there is a closed issue about unravel docs, but still no docs for it #1309 |
As far as I can see there is an xt::xtensor<size_t,2> a = xt::zeros<size_t>({5, 2});
xt::xtensor<size_t,1> i = {0, 1, 2, 3};
xt::xtensor<size_t,2> idx = xt::from_indices(xt::unravel_indices(i, a.shape()));
std::cout << idx << std::endl; But I do agree that we need to work on consistency with NumPy here. Also I feel that the overloads are not super flexible. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In numpy we have this:
>>>np.unravel_index(0, [1,32,32,1])
(0, 0, 0, 0)
>>>np.unravel_index([0,1,2], [1,32,32,1])
(array([0, 0, 0]), array([0, 0, 0]), array([0, 1, 2]), array([0, 0, 0]))
But in xtensor we can only use unravel with one index. Also we'll get by this not an xarray of
dimensions, but this:
Why is it so?