Skip to main content

numba-bessel

CI Status Documentation Status

Test coverage percentage uv Ruff prek

PyPI Version Supported Python versions License


Documentation: https://numba-bessel.readthedocs.io

Source Code: https://github.com/34j/numba-bessel


Compute principal-sheet complex Bessel functions (J, Y, I, K) across all finite binary64 arguments and real orders |nu| < 2^53 on CPU (Numba / NumPy / Array API / @njit) and CUDA (PyTorch / CuPy / numba-cuda-mlir) through a single unified API with recurrence-accelerated sequences (*_all).

Installation

pip install numba-bessel

For GPU execution via numba-cuda-mlir:

pip install "numba-bessel[cuda]"

Usage

CPU (NumPy, scalars, and inside @njit)

import numpy as np
from numba import njit
from numba_bessel import OK, besselj, besselj_all, besselk

# Arbitrary real orders |nu| < 2^53 (positive and negative)
nu = np.array([2.3, -1.5])
z = np.array([1.2 + 0.4j, complex(-2.0, -0.0)])  # negative-real cut lips use ±0.0
vals = besselj(nu, z)
assert vals.shape == (2,) and np.isfinite(vals).all()

# Recurrence-accelerated sequence nu, nu+1, ..., nu+n_end-1
seq, status = besselj_all(-1.3, z, n_end=4, return_status=True)
assert seq.shape == (2, 4) and np.all(status == OK)

# Failed evaluations return nan+nanj and diagnostic status codes
bad_val, bad_status = besselk(0.0, 0.0j, return_status=True)
assert np.isnan(bad_val) and bad_status != OK

# Direct use inside @njit (scalar inputs and return_status)
@njit(fastmath=False)
def eval_inside_njit(nu_s: float, z_s: complex) -> complex:
    return besselj(nu_s, z_s)

assert np.isfinite(eval_inside_njit(3.3, 1.5 + 0.25j))

GPU (PyTorch CUDA, CuPy, or any CUDA Array API)

The same functions dispatch to CUDA automatically when given GPU arrays via array-api-compat:

import torch
from numba_bessel import besselj, besselj_all

torch.set_default_device("cuda")
nu = torch.tensor([2.3, -1.5], dtype=torch.float64)
z = torch.tensor([1.2 + 0.4j, complex(-2.0, -0.0)], dtype=torch.complex128)

vals = besselj(nu, z)
seq = besselj_all(-1.3, z, n_end=4)  # shape: (2, 4) on cuda:0

See the algorithm reference for the mathematical proofs, regional numerical portfolio, recurrence architecture, and qualification results.

Metadata

Release files for numba-bessel 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numba-bessel 1.3.0
File Size Uploaded Provenance Actions
numba_bessel-1.3.0.tar.gz 54.3 kB With provenance Details for numba_bessel-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for numba-bessel 1.3.0
File Interpreter ABI Platform Actions
numba_bessel-1.3.0-py3-none-any.whl Python 3 none any Details for numba_bessel-1.3.0-py3-none-any.whl

Total release size: 81.7 kB

Release files / numba_bessel-1.3.0.tar.gz

Download URL numba_bessel-1.3.0.tar.gz
Size 54.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2980922debb456c24efb36cbb0f8b2d0a458d7be588d50ddb53ca514cdf89867
BLAKE2b-256 checksum
How to use checksums
19591f965ea917733d8bc4c7e6aebda43538fea59ef89cd3b32b8c5b964d6cef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / numba_bessel-1.3.0-py3-none-any.whl

Download URL numba_bessel-1.3.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42c616c072473fe102e3aa5179c716f0faed3591d525b5e0619e6601e42ad61c
BLAKE2b-256 checksum
How to use checksums
5305e1fb94a940c425025e802eff9dfe35a670869e457e278d2ff1463febc22f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for numba-bessel 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for numba_bessel-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page