stan-dev / stan-dev/math

operator* does not compile for one input matrix with double and other with var scalars

Open
#2,103 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

operator* (matrix multiplication) does not compile for one input matrix with double and other with var scalars.

Both stan and tests always use multiply function, so this went undetected.

Example

  int N = 2;
  int M = 3;
  int K = 4;

  Eigen::MatrixXd a(N, M);
  a << 1, 2, 3, 4, 5, 6;
  stan::math::matrix_v b(M, K);
  b << 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1;
  stan::math::matrix_v c = a * b;

Does not compile.

Expected Output

operator* compiles and does the same as multiply function.

Current Version:

v3.3.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 compiling the provided operator* example and compare its behavior with the existing multiply function, which the issue identifies as the working path. Trace the operator* entry point and related tests, then add coverage for mixed double and var-scalar matrices; done means the example compiles and matches multiply.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.