relax type identity between constrained variable and target log density
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
In the constrain_XXX functions applied to map unconstrained parameters to parameters in Stan, the value being constrained is required to be the same type as the log density target being incremented. These functions should allow the two types to vary independently. The target will always be at least double, whereas the variable being constrained might be int when used in the language.
Example
template <typename T, typename L, typename U>
inline return_type_t<T, L, U> lub_constrain(const T& x, const L& lb,
const U& ub, T& lp) {
Expected Output
For all of the XXX_constrain functions with an lp argument, the types should be generalized to look like this:
template <typename T, typename L, typename U, typename L>
inline return_type_t<T, L, U> lub_constrain(const T& x, const L& lb,
const U& ub, L& lp)
On the identity constrain version, that means the lp argument needs to be uncommented to support type inference.
Current Version:
v3.1.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
Start by locating the constrain_XXX functions with an lp argument, including the identity constrain variant. Review their template parameters and how the lp argument is typed; done means all such functions allow the constrained value and target log density to use independent types, with identity constrain type inference supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100