owlbarn / owl

Owl - OCaml Scientific Computing @ https://ocaml.xyz
MIT License
1.2k stars 120 forks source link

Avoid calling `log(0)` when generating gaussian random variables #662

Closed edwintorok closed 3 months ago

edwintorok commented 3 months ago

Draft pull request because the following unit test fails (but it also fails before any of my changes):

File "test/unit_stats_rvs.ml", line 757, character 2:
FAIL Avg ppf error in 'gamma_shape_0.900000_scale_1.000000' <1E-28

   Expected: `true'
   Received: `false'

Raised at Alcotest_engine__Test.check in file "src/alcotest-engine/test.ml", line 200, characters 4-261
Called from Dune__exe__Unit_stats_rvs.test_rough_cdf in file "test/unit_stats_rvs.ml", line 757, characters 2-107
Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15
Called from Dune__exe__Unit_stats_rvs.test_rough_cdf_matches in file "test/unit_stats_rvs.ml", line 779, characters 2-45
Called from Alcotest_engine__Core.Make.protect_test.(fun) in file "src/alcotest-engine/core.ml", line 181, characters 17-23
Called from Alcotest_engine__Monad.Identity.catch in file "src/alcotest-engine/monad.ml", line 24, characters 31-35