multivar_horner
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. Compiled evaluator caches are platform-specific, so the same installation can be used safely on ARM64 and x86_64 systems without reusing incompatible binaries.
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.1
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.1.tar.gz | 48.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multivar_horner-3.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 81.6 kB
Release files / multivar_horner-3.2.1.tar.gz
| Download URL | multivar_horner-3.2.1.tar.gz |
|---|---|
| Size | 48.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ef4791b2ffc8f936407b85edb4b12771e601c2dc6edffbfeb57619fb992dac3
|
|
BLAKE2b-256 checksum How to use checksums |
cc8bda652873298c9549dc072e5db012222dc1acb493bf4ec0ee782b8c18ae82
|
| 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.1-py3-none-any.whl
| Download URL | multivar_horner-3.2.1-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa306f4737e454c84a96eff74d7d22a529795dab2a8b0efb191a6ae3890fde08
|
|
BLAKE2b-256 checksum How to use checksums |
9a74335416d0161fa8ffa1ece49fad390000c0e0459f3e3ae2099e49743a8868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|