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 exact split orders nu + n (0 <= nu < 1, 0 <= n < 2^64) on CPU (Numba / NumPy / Array API / @njit) and CUDA (PyTorch / CuPy / numba-cuda-mlir) through a single unified API.

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

# Single order nu + n (broadcasts across Array-API arrays)
nu = np.array([0.3, 0.5])
z = np.array([1.2 + 0.4j, complex(-2.0, -0.0)])  # negative-real cut lips use ±0.0
vals = besselj(nu, z, n=2)
assert vals.shape == (2,) and np.isfinite(vals).all()

# Sequence of orders nu + first + k for k = 0..n_end - 1
seq, status = besselj_all(0.3, z, n_end=4, first=1, 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, 3)

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

GPU (PyTorch CUDA, CuPy, or DeviceNDArray)

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

import torch
from numba_bessel import besselj, besselj_all

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

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

See the algorithm reference for the mathematical proofs, regional numerical portfolio, literature comparison, and qualification results.

Metadata

Release files for numba-bessel 1.2.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.2.0
File Size Uploaded Provenance Actions
numba_bessel-1.2.0.tar.gz 55.1 kB With provenance Details for numba_bessel-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 82.1 kB

Release files / numba_bessel-1.2.0.tar.gz

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

Download URL numba_bessel-1.2.0-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4349f5705351605fc382207e051f97e9ff388ea0187934535f8bbcfe47e3ed95
BLAKE2b-256 checksum
How to use checksums
f4b2083edfcbfa8b161db67f95a87f3d1939a2f9978ad47e218cb2c27c9851c9
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.2.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.2.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