version of array_builder producing matrix and row_vector objects without copies
@mitzimorris is already working on this.
Since Mar 12, 2017.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Summary:
Right now, the usage through Stan in the generated code is to construct a std::vector, fill it, then copy it, then convert that into a matrix or row vector. The intermediate copy should be eliminated to reduce memory contention on the heap from the redundant copy.
This should then be pushed through the generator code in Stan for row vector and matrix expressions.
Description
The new method should look like this:
Eigen::Matrix<T, -1, 1> array_builder<T>::row_vector()
and similarly for ::matrix().
This will require either writing a new array-builder class inside the matrix directory or writing a new matrix_builder and new row_vector_builder class. These are still going to require std::vector on the inside to be able to incrementally build a sequence without knowing its size ahead of time.
Current Version:
v2.14.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.