Matrix comprehensions (`build_matrix` function)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
This would be a variadic function with signature:
matrix build_matrix(int I, int J, Fn f, T1 arg1,...TN argN) (name up for debate)
where Fn is a function (int, int, T1, ..., TN) => real
It returns a matrix M such that M[i,j] = f(i,j, arg1, ... argN)
The real advantage to this function is that it can do local autodiff, which will improve memory usage/locality and allow us to have the returned matrix be a SoA matrix (cf https://github.com/stan-dev/math/issues/2344#issuecomment-770418908).
Once implemented, build_[row]_vector is the obvious extension.
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
The issue defines a variadic build_matrix signature and the required matrix relationship M[i,j] = f(i,j,args). No files or tests are named, so begin by locating the existing matrix construction and automatic-differentiation entry points. Done means agreeing on the function name and supporting local autodiff and SoA matrix results; build_[row]_vector is a later extension.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100