categorical_* functions don't accept row_vectors (it would be good that they could)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Summary:
The functions for the categorical distribution only accept a column vector, it would be great if it could accept also row vectors.
Description:
I use the categorical distribution to go over a matrix N_obs x N_probabilities, so it's more natural for me to use row vectors than column vectors.
Current functions:
real categorical_lpmf(ints y | vector theta)
real categorical_logit_lpmf(ints y | vector beta)
int categorical_rng(vector theta)
Expected functions:
real categorical_lpmf(ints y | row_vector theta)
real categorical_logit_lpmf(ints y | row_vector beta)
int categorical_rng(row_vector theta)
Current Version:
v2.15.0
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
Locate the categorical_lpmf, categorical_logit_lpmf, and categorical_rng entry points and inspect how their vector arguments are handled. Verify the expected row_vector forms for all three functions and confirm that existing column-vector behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100