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.1

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.1
File Size Uploaded Provenance Actions
numba_bessel-1.3.1.tar.gz 55.1 kB With provenance Details for numba_bessel-1.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 83.0 kB

Release files / numba_bessel-1.3.1.tar.gz

Download URL numba_bessel-1.3.1.tar.gz
Size 55.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc03e880c2cad8843cd5d594dd9075489279932f771d3c618aafa17fc583c397
BLAKE2b-256 checksum
How to use checksums
92aa33ee92519e8e904602b5049e41f47a7b0c19bec42f9d9dd35de0c7507b11
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.1-py3-none-any.whl

Download URL numba_bessel-1.3.1-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88408af9f78b8f07b19a599dc52f995eedbdcb81ba584f1a969b3590ebcca188
BLAKE2b-256 checksum
How to use checksums
204c8280e47777f360cda98eaa94bdf7995567d31c3b2bb6e93ae61481b9e07a
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.1

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.1.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