Add `where`/`select` functions
Open
Nobody has claimed this yet.
new function
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Another part of https://github.com/stan-dev/stan/issues/3300#issuecomment-3188755711
Two useful functions:
select(ints, T)takes in a container container of integers in {0, 1} and a same-sized other container and returns a new container with those elements picked out (size is sum(first arg))where(ints, T1, T2)takes in two containers and essentially does an element wise version of the ternary operator. Where ints is 1, the corresponding index inT1is used, where it is 0,T2
These can be treated as two functions, or they could be both be called where and be overloads (this is what numpy does)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Stan issue comment and the two proposed operations in this issue. Determine whether select and where should be separate functions or overloads, then verify that the implementation supports the stated integer-mask and container-selection behavior across the relevant container types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100