Error with `non_central_chi_squared::find_degrees_of_freedom` when running with Valgrind

Open
#95 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start at non_central_chi_squared::find_degrees_of_freedom and reproduce the R-C++ wrapper call under Valgrind using the reported delta, q, and p arguments. Trace where the degrees-of-freedom value becomes NaN; done means explaining the failure and identifying the affected behavior or fix.

Written by the indexing model from the issue text.

Description

Hello,

I ported the function non_central_chi_squared::find_degrees_of_freedom to a R package. My R-C++ function is just:

double find_chisq_df(double delta, double q, double p){
  // gives nu such that pchisq(q, nu, delta) = p
  return non_central_chi_squared::find_degrees_of_freedom(delta, q, p);
}

When an example is executed under Valgrind, this error is generated:

Error in function boost::math::non_central_chi_squared_distribution<long double>::non_central_chi_squared_distribution(long double,long double): Degrees of freedom argument is -nan, but must be > 0 !

Would you have an idea of the cause? I'm really not fluent in C++.

Dominant language
C++
Stars
42
Forks
76
Avg merge
3d 22h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

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 boostorg/random

All issues in boostorg/random

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.