Commits


Rossi Sun authored and GitHub committed 3222e2a252b
GH-44393: [C++][Compute] Vector selection functions `inverse_permutation` and `scatter` (#44394) ### Rationale for this change For background please see #44393. When implementing the "scatter" function requested in #44393, I found it also useful to make it a public vector API. After a painful thinking, I decided to name it "permute". And when implementing permute, I found it fairly easy to implement it by first computing the "reverse indices" of the positions, and then invoking the existing "take", where I think "reverse_indices" itself can also be a useful public vector API. Thus the PR categorized them as "placement functions". ### What changes are included in this PR? Implement vector selection API `inverse_permutation` and `scatter`, where `scatter(values, indices)` is implemented as `take(values, inverse_permutation(indices))`. ### Are these changes tested? UT included. ### Are there any user-facing changes? Yes, new public APIs added. Documents updated. * GitHub Issue: #44393 Lead-authored-by: Ruoxi Sun <zanmato1984@gmail.com> Co-authored-by: Rossi Sun <zanmato1984@gmail.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr> Signed-off-by: Antoine Pitrou <antoine@python.org>