Skip to content

Commit

Permalink
fix: rvs in jit (#110)
Browse files Browse the repository at this point in the history
Closes #108

dist.rvs now also works in a compiled context.

---------

Co-authored-by: Jan wagner <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hans Dembinski <[email protected]>
  • Loading branch information
4 people authored Sep 24, 2024
1 parent dc2b36b commit 8b3d04a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/numba_stats/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def {fname}({args}):
@_overload({fname}, inline="always")
def _ol_{fname}({args}):
return {impl}
return {impl}.__wrapped__
"""
else:
code = f"""
Expand Down
9 changes: 9 additions & 0 deletions tests/test_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ def test(x):
y = test(x)

assert_allclose(y, fn(x, 0, 1))


@pytest.mark.filterwarnings("error")
def test_rvs_njit():
@nb.njit
def test():
return norm.rvs(0.0, 1.0, 10, 1)

assert_allclose(test(), norm.rvs(0, 1, 10, 1))

0 comments on commit 8b3d04a

Please sign in to comment.