Skip to content

Initial implementation of fisher_f degrees of freedom finder#1407

Open
JacobHass8 wants to merge 6 commits into
boostorg:developfrom
JacobHass8:f-find-df
Open

Initial implementation of fisher_f degrees of freedom finder#1407
JacobHass8 wants to merge 6 commits into
boostorg:developfrom
JacobHass8:f-find-df

Conversation

@JacobHass8

@JacobHass8 JacobHass8 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This is a simple copy and paste from the previous PR . I still need to implement a couple of tests. One set of tests to check if the function works as intended and the other to see if we properly catch the case when there are multiple degrees of freedom.

As noted above, most of this is copy and pasted from the non_central_f distribution implementation of these same functions. I wonder if it would be more concise to program a special case of the non_central_f functions when nc=0. When nc=0 we can just use the fisher_f distribution? Now that I type it out, I think I might go with that.

Closes #1305.

@JacobHass8

JacobHass8 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Hmmm, I'm not sure why this is failing on some of the platforms. The error message is

../../../boost/math/distributions/fisher_f.hpp: In static member function ‘static RealType boost::math::fisher_f_distribution<RealType, Policy>::find_v1(RealType, RealType, RealType)’:
../../../boost/math/distributions/fisher_f.hpp:58:34: error: ‘find_degrees_of_freedom_f’ is not a member of ‘boost::math::detail’
   58 |       eval_type result = detail::find_degrees_of_freedom_f(
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../boost/math/distributions/fisher_f.hpp: In static member function ‘static RealType boost::math::fisher_f_distribution<RealType, Policy>::find_v1(const boost::math::complemented3_type<A, B, C>&)’:
../../../boost/math/distributions/fisher_f.hpp:81:34: error: ‘find_degrees_of_freedom_f’ is not a member of ‘boost::math::detail’
   81 |       eval_type result = detail::find_degrees_of_freedom_f(
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../boost/math/distributions/fisher_f.hpp: In static member function ‘static RealType boost::math::fisher_f_distribution<RealType, Policy>::find_v2(RealType, RealType, RealType)’:
../../../boost/math/distributions/fisher_f.hpp:103:34: error: ‘find_degrees_of_freedom_f’ is not a member of ‘boost::math::detail’
  103 |       eval_type result = detail::find_degrees_of_freedom_f(
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../boost/math/distributions/fisher_f.hpp: In static member function ‘static RealType boost::math::fisher_f_distribution<RealType, Policy>::find_v2(const boost::math::complemented3_type<A, B, C>&)’:
../../../boost/math/distributions/fisher_f.hpp:126:34: error: ‘find_degrees_of_freedom_f’ is not a member of ‘boost::math::detail’
  126 |       eval_type result = detail::find_degrees_of_freedom_f(
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~

but find_degrees_of_freedom_f is defined in non_central_f.hpp which I included in fisher_f.hpp. @jzmaddock do you have any ideas?

@jzmaddock

Copy link
Copy Markdown
Collaborator

I suspect you've created a cyclic include - a really bad thing and all kinds of badness can ensue! If I'm right and the non-central-f depends on the regular f (which I suspect it should), then either moving the common code into fisher_f.hpp or a common shared header of it's own would do it.

@JacobHass8

Copy link
Copy Markdown
Contributor Author

I suspect you've created a cyclic include - a really bad thing and all kinds of badness can ensue! If I'm right and the non-central-f depends on the regular f (which I suspect it should), then either moving the common code into fisher_f.hpp or a common shared header of it's own would do it.

Hmmm, unfortunately I think I'm going to have to duplicate the code. I need the fisher and non-central fisher distributions to be able to access the function but both distributions need to used to create the function. Even putting it in a separate file would require cyclic including.

@JacobHass8

Copy link
Copy Markdown
Contributor Author

If all the tests pass, then this is probably ready to merge.

@jzmaddock

Copy link
Copy Markdown
Collaborator

Looks like the tolerances are just slightly too tight on a couple of tests?

@JacobHass8

Copy link
Copy Markdown
Contributor Author

Looks like the tolerances are just slightly too tight on a couple of tests?

The most recent CI run doesn't show any failures due to this PR unless I'm mistaken.

@jzmaddock

Copy link
Copy Markdown
Collaborator

MacOS failure is spurious, syscl shows:

 8/63 Test  #8: run-boost_math-test_fisher_f ...........................***Failed    0.02 sec
Running 1 test case...
Tolerance = 0.2%.
Tolerance = 5.96046e-05%.
Tolerance = 5.96046e-05%.
Tolerance = 0.2%.
Tolerance = 1.11022e-13%.
Tolerance = 1.11022e-13%.
/home/runner/work/math/boost-root/libs/math/test/test_fisher_f.cpp(424): error: in "test_main": difference{1.49214e-14} between fisher_f_distribution<RealType>::find_v1(x, df2, P){10.000000000000149} and df1{10} exceeds 1.11022e-12%
/home/runner/work/math/boost-root/libs/math/test/test_fisher_f.cpp(425): error: in "test_main": difference{1.49214e-14} between fisher_f_distribution<RealType>::find_v1(boost::math::complement(x, df2, 1-P)){10.000000000000149} and df1{10} exceeds 1.11022e-12%

*** 2 failures are detected in the test module "Master Test Suite"

Drone failures are similar tolerance issues in test_fisher_f.

@JacobHass8

Copy link
Copy Markdown
Contributor Author

MacOS failure is spurious, syscl shows:
Drone failures are similar tolerance issues in test_fisher_f.

Oops, I didn't even realize syscl or Drone ran these tests. That's good to know for the future so I don't ignore these.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.67442% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.39%. Comparing base (9a964b4) to head (a5ea945).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
include/boost/math/distributions/fisher_f.hpp 96.77% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1407   +/-   ##
========================================
  Coverage    95.39%   95.39%           
========================================
  Files          826      826           
  Lines        68901    68983   +82     
========================================
+ Hits         65729    65809   +80     
- Misses        3172     3174    +2     
Files with missing lines Coverage Δ
include/boost/math/distributions/non_central_f.hpp 90.73% <100.00%> (ø)
test/test_fisher_f.cpp 100.00% <100.00%> (ø)
include/boost/math/distributions/fisher_f.hpp 87.70% <96.77%> (+3.08%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a964b4...a5ea945. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: more inverses for distribution CDFs

2 participants