Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski authored Jan 22, 2025
1 parent 505affb commit 5a87b1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ sigma = ... # some array
y = norm.pdf(x, mu, sigma)
```

See the [Rationale](#rationale) for an explanation. If you need this functionality, it is probably best to use the scipy implementation. You could try to write a small numba-wrapper, but it is probably slower than just using scipy. For example, this implementation is 6-7 times slower than scipy on my computer when applied to arrays with 100000 entries.
See the [Rationale](#rationale) for an explanation. If you need this functionality, it is best to use the scipy implementation. When that is not an option, for example, because you want to use a distribution that is only available in numba-stats, you can write a small wrapper like this:

```py
@nb.njit
Expand All @@ -126,7 +126,7 @@ def norm_pdf_v(x, mu, sigma):
return result
```

The performance is poor, because each call to norm.pdf inside the loop allocates and deallocates an array, which is very expensive.
The performance is poor, because each call to norm.pdf inside the loop allocates and deallocates an array, which is very expensive. This implementation is 6-7 times slower than the scipy implementation on my computer when applied to arrays with 100,000 entries.

## Documentation

Expand Down

0 comments on commit 5a87b1a

Please sign in to comment.