stan-dev / stan-dev/stan

FR: `model_base` methods - use `Eigen::Ref<Eigen::VectorXd>`

Open
#3,289 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.8k
Forks
388
Avg merge
2d 17h
Merged PRs (30d)
15

Description

Summary:

The Eigen overloads for model base methods like log_prob and unconstrain_array only accept Eigen::VectorXd inputs, which can require some data-reshaping/copying for downstream interfaces.

If these could be changed to Eigen::Ref<Eigen::VectorXd> (or overloads for these added), then the current Stan behaviour would be unchanged but interfaces could then pass Eigen::Map<Eigen::VectorXd> types and avoid extra copies

Current Version:

v2.35.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the model base Eigen overloads for methods such as log_prob and unconstrain_array, then inspect how their current Eigen::VectorXd parameters are used. Done means preserving current Stan behavior while accepting Eigen::Ref<Eigen::VectorXd> or suitable overloads so downstream interfaces can pass Eigen::Map<Eigen::VectorXd> without extra copies.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.