Skip to main content

Compute Jacobi polynomial from order 0 to N efficiently in NumPy / PyTorch / JAX / array API

Project description

Jacobi Poly

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://jacobi-poly.readthedocs.io

Source Code: https://github.com/34j/jacobi-poly


Compute Jacobi polynomial from order 0 to N efficiently in NumPy / PyTorch / JAX / array API

Installation

Install this via pip (or your favourite package manager):

pip install jacobi-poly

Usage

from jacobi_poly import jacobi_all, gegenbauer_all, legendre_all
import torch

# Both CPU (Numba) and CUDA (Numba for CUDA) are supported.
torch.set_default_device("cuda")

x = torch.asarray(1.0)  # the points to evaluate at
alpha = torch.asarray(2.0)
beta = torch.asarray(3.0)
n_end = 4  # from order 0 to order 3

# Jacobi polynomial from order 0 to 3
jacobi = jacobi_all(x, alpha=alpha, beta=beta, n_end=n_end)
print(jacobi)
# tensor([ 1.,  3.,  6., 10.], device='cuda:0')

# Gegenbauer polynomial from order 0 to 3
gegenbauer = gegenbauer_all(x, alpha=alpha, n_end=n_end)
print(gegenbauer)
# tensor([ 1.0000,  4.0000, 10.0000, 20.0000], device='cuda:0')

# Generalized Legendre polynomial from order 0 to 3
# If ndim == 3, same as Legendre polynomial
legendre = legendre_all(x, n_end=n_end, ndim=3)
print(legendre)
# tensor([1., 1., 1., 1.], device='cuda:0')

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jacobi_poly-1.0.6.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jacobi_poly-1.0.6-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file jacobi_poly-1.0.6.tar.gz.

File metadata

  • Download URL: jacobi_poly-1.0.6.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jacobi_poly-1.0.6.tar.gz
Algorithm Hash digest
SHA256 9c85e615a220c7f9ad8769f7ae6ffde9267d03a573bd3be6f2e747e61481f9af
MD5 74a63be5f76f8b3c4c893091d233004f
BLAKE2b-256 f45339d1ee12c08a3ccd426401ba1cd9dfd7f47c85d4c73c5fc6f4c86ef02fac

See more details on using hashes here.

Provenance

The following attestation bundles were made for jacobi_poly-1.0.6.tar.gz:

Publisher: ci.yml on 34j/jacobi-poly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jacobi_poly-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: jacobi_poly-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jacobi_poly-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 afc24c89e6c7cc5d52cbd54b3f6b3de0a7ddd4cb66bd56190db22b20c2355cf4
MD5 968e9f1b28f7fc3df349632f7078d5b2
BLAKE2b-256 944a7eb8bd7466947029a57a8dcdad5a5f25e2fd5726e9e96876d06ec5a2fa59

See more details on using hashes here.

Provenance

The following attestation bundles were made for jacobi_poly-1.0.6-py3-none-any.whl:

Publisher: ci.yml on 34j/jacobi-poly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page