stan-dev / stan-dev/math

Autodiff framework never runs functions that have size zero outputs

Open
#2,407 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

With a lot of our matrix functions we are allowing size zero inputs and expecting size zero outputs.

Sometimes these size zero edge cases give segfaults or other unexpected things, and should be checked.

Right now the autodiff test framework is only evaluating autodiff'd functions if the output is non-zero size. Check here.

Current Version:

v4.0.1

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 at test/unit/math/test_ad.hpp around line 476, where autodiff functions are evaluated only when the output has non-zero size. Trace the surrounding test framework and adjust its coverage so functions producing size-zero outputs are evaluated as well; done means these edge cases are checked without being skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.