base_nuts.hpp:110 — Unnecessary .transpose() on column vector

Open Beginner friendly
#3,381 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
backend

Research direction

Review base_nuts.hpp around line 110, focusing on the assignment from z_.p to rho. Confirm that rho uses the VectorXd directly without transpose and that the change compiles successfully under strict Eigen assertions.

Written by the indexing model from the issue text.

Description

Eigen::VectorXd rho = this->z_.p.transpose();
z_.p is a VectorXd (D×1). .transpose() produces a RowVectorXd (1×D), which is
then assigned to a VectorXd (D×1). This works due to Eigen's dynamic resizing
but could trigger debug assertions in strict Eigen builds. Should just be rho
= this->z_.p;.

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

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.

More from stan-dev/stan

All issues in stan-dev/stan

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.