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)
| File | Size | Uploaded | |
|---|---|---|---|
| multivar_horner-3.2.0.tar.gz | 47.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|