stan-dev / stan-dev/math

Vectorise (and varmat) `log_diff_exp` and `log_sum_exp` binary overloads

Open
#2,785 0 comments 1 reaction 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

The binary overload for log_sum_exp currently only accepts two scalar arguments (i.e., not two matrices to operate elementwise on). While the binary overload for log_diff_exp does accept two matrix/container arguments, the vectorisation is handled by apply_scalar_binary.

For both of these functions there are likely to be performance benefits from adding vectorised & varmat implementations

While not directly related, the context is for optimising (Gaussian) copula models

Current Version:

v4.4.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

Locate the binary overloads for log_sum_exp and log_diff_exp, along with the existing apply_scalar_binary path and nearby matrix/container implementations. Compare how vectorized and varmat operations are handled elsewhere in the library; done means both functions support the intended elementwise arguments without relying on the slower scalar-application path.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.