single templated implementation of constraints
@SteveBronder is already working on this.
Since Aug 23, 2021.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
After #2559 is merged, it'd be nice to refactor the implementations.
- Single Jacobian-templated implementation. Those are going to look as follows.
template <bool Jacobian, typename T>
inline auto XXX_constrain(..., scalar_type_t<T>& lp) {
value = ...value calculations...
if (Jacobian)
lp += ...Jacobian calc...
return value;
}
-
Deprecate the untemplated
XXX_constrainfunctions. -
Delegate implementations of untemplated
XXX_constrainfunctions to the Jacobian-templated version. -
Make sure doc of templated version doesn't point to untemplated version; OK to point to the Stan Reference Manual chapter Constraint Transforms.
Finishing this should remove all the cut-and-paste in the constraining transform code.
What would really be nice is if we could somehow group the constraining and unconstraining transforms together as a unit we can manipulate, but we can save that for a subsequent issue.
Current Version:
v4.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.
Assessment
This issue has not been assessed yet.