Comments on Matrix Autodiff Type
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- compilers, documentation
Research direction
Start with the matrix autodiff design document referenced by the issue and review the three proposed additions: the matrix-of-vars rationale, an annotated Stan-program compiler option, and an explicit matrixvar-to-varmatrix conversion. Done would mean that the design document records clear decisions and scope for these suggestions.
Written by the indexing model from the issue text.
Description
A few comments for consideration in the matrix autodiff design document.
-
As much as the matrix of vars enables better performance it also greatly facilities the implementation matrix-valued reverse mode updates, as demonstrated in the matrix product example. The resulting code is not only easier to develop but also easier to read -- all in addition to likely being much faster. Perhaps worthy of mentioning in the summary.
-
Given the amount of compiler logic proposed it would be great to have a compiler option that returns an annotated Stan program indicating with variables were assigned
matrix<var>and which were assignedvar<matrix>. This would help users track down undesired casts down tomatrix<var>and optimize their code without having to guess at the underlying compiler logic. -
It would also be great to have some way to force a conversion from a
matrix<var>to avar<matrix>, even if only with a function meant for advanced users. I'm thinking in particular of Gaussian process applications where custom Gram matrices are built element by element in a user-defined function, but afterwards are used used as only monolithic matrices. My understanding of the proposed logic is that this would propagate amatrix<var>throughout the Stan program and miss out on potential performance unless there is some way to force a user-defined function to return avar<matrix>to cast the return, for example
functions {
matrix custom_covar(...);
}
...
model {
matrix[N, N] custom_gram = to_varmat(custom_covar(...));
}
- Dominant language
- No language data
- Stars
- 41
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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.
More from stan-dev/design-docs
-
Annotation comment Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
stan-dev/design-docs#55 · 3 comments ·
All issues in stan-dev/design-docs
Similar issues
-
compiler/runtime
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EricSpencer00/Resilient#4824 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/jeo-maven-plugin#1758 ·
-
generics
Difficulty 2/5 1-3 hours Newbie friendliness 82/100