Skip to main content
Build status documentation status https://img.shields.io/pypi/wheel/multivar-horner.svg pre-commit Total PyPI downloads latest version on PyPI JOSS status https://zenodo.org/badge/155578190.svg https://img.shields.io/badge/code%20style-black-000000.svg

multivar_horner is a python package implementing a multivariate Horner scheme (“Horner’s method”, “Horner’s rule”) for efficiently evaluating multivariate polynomials.

Supported environments

The 3.2 series requires Python >=3.12,<4 without restricting future Python 3 minor releases, and NumPy >=2.2,<2.5, subject to its own Python requirements. The Python and NumPy minimums follow the three-year and two-year support windows, respectively, recommended by SPEC 0. CI covers NumPy 2.x on Python 3.12–3.14, both with and without the optional Numba extra (Numba >=0.64,<1). Python 3.8–3.11 users should retain the 3.1 series.

Real evaluation uses a C compiler (gcc or cc) by default. Install multivar_horner[numba] for accelerated recipe evaluation when a compiler is unavailable. Complex evaluation always uses the recipe backend. ARM-specific compilation/cache compatibility is tracked in GitHub issue #50.

Quick Guide:

pip install multivar_horner

For efficiency this package is compiling the instructions required for polynomial evaluation to C by default. If you don’t have a C compiler (gcc or cc) installed you also need to install numba for using an alternative method:

pip install multivar_horner[numba]

Simple example:

import numpy as np
from multivar_horner import HornerMultivarPolynomial

# input parameters defining the polynomial
#   p(x) = 5.0 + 1.0 x_1^3 x_2^1 + 2.0 x_1^2 x_3^1 + 3.0 x_1^1 x_2^1 x_3^1
coefficients = np.array([[5.0], [1.0], [2.0], [3.0]], dtype=np.float64)
exponents = np.array([[0, 0, 0], [3, 1, 0], [2, 0, 1], [1, 1, 1]], dtype=np.uint32)

# [#ops=7] p(x) = x_1 (x_1 (x_1 (1.0 x_2) + 2.0 x_3) + 3.0 x_2 x_3) + 5.0
horner_polynomial = HornerMultivarPolynomial(coefficients, exponents)
x = np.array([-2.0, 3.0, 1.0], dtype=np.float64)
p_x = horner_polynomial(x)

Also see:

Release files for multivar-horner 3.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 multivar-horner 3.2.0
File Size Uploaded
multivar_horner-3.2.0.tar.gz 47.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for multivar-horner 3.2.0
File Interpreter ABI Platform
multivar_horner-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.7 kB

Release files / multivar_horner-3.2.0.tar.gz

Download URL multivar_horner-3.2.0.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
af821fd6b1be6b7690f9ee8e1f65b42738a2218dfa2113560f314e95fbd1ff7f
BLAKE2b-256 checksum
How to use checksums
6e9fa02cfdb24a8e9c125b45d5f13b11df3dbdf71d6ca543d84b3239a17ae252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / multivar_horner-3.2.0-py3-none-any.whl

Download URL multivar_horner-3.2.0-py3-none-any.whl
Size 32.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be255e67385b218f14edf9b658ed6321a95acefcc7571f2c2a65acecbc7b9b5e
BLAKE2b-256 checksum
How to use checksums
5058c24d4baa3f6214611e24dc746722d0f32d6651ab2f38701c2cac97f0752a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

3.2.1

2 release files

This release

3.2.0 This release

2 release files

3.1.0

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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