Add bessel_i0e and bessel_i1e ops#3193
Open
robert-johansson wants to merge 1 commit intoml-explore:mainfrom
Open
Add bessel_i0e and bessel_i1e ops#3193robert-johansson wants to merge 1 commit intoml-explore:mainfrom
robert-johansson wants to merge 1 commit intoml-explore:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds element-wise exponentially scaled modified Bessel functions of the first kind:
bessel_i0e(x)= exp(-|x|) I₀(x)bessel_i1e(x)= exp(-|x|) I₁(x)These are the numerically stable building blocks for Bessel-dependent distributions (von Mises, Rice, noncentral chi-squared) in probabilistic programming and physics applications. Relates to #21 (bessel functions requested).
bessel.h)grad(i0e)= i1e(x) - sign(x)·i0e(x),grad(i1e)= i0e(x) - (sign(x) + 1/x)·i1e(x) with safe x=0 handlingmx.bessel_i0e()andmx.bessel_i1e()with docstringsThe algorithm is Cephes (public domain, Stephen Moshier) — the same implementation used by SciPy, JAX/XLA, PyTorch, and TensorFlow. Float32 relative error < 2e-7 across the full range.
Test plan
🤖 Generated with Claude Code