Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-44393: [C++][Compute] Placement vector functions #44394

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

zanmato1984
Copy link
Collaborator

@zanmato1984 zanmato1984 commented Oct 13, 2024

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 placement API reverse_indices and permute, where permute(values, indices) is implemented as take(values, reverse_indices(indices)).

I also put a small UT Permute.IfElse demonstrating how permute can serve as a building block of implementing special forms.

Are these changes tested?

UT included.

Are there any user-facing changes?

Yes, new public APIs added. Documents updated.

Copy link

⚠️ GitHub issue #44393 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions bot added the awaiting review Awaiting review label Oct 13, 2024
@zanmato1984
Copy link
Collaborator Author

Hi, @felipecrv @pitrou . Could you help to review this? I think this is a necessary building block for special forms (#41094 (comment)). Much appreciated!

@zanmato1984 zanmato1984 changed the title GH-44393: Placement vector functions GH-44393: [C++][Compute] Placement vector functions Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant