python package implementing a multivariate Horner scheme for efficiently evaluating multivariate polynomials
Project description
multivar_horner is a python package implementing a multivariate Horner scheme (“Horner’s method”, “Horner’s rule”) for efficiently evaluating multivariate polynomials.
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)
For more refer to the documentation.
Also see: GitHub, PyPI, arXiv paper
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multivar_horner-3.1.0.tar.gz.
File metadata
- Download URL: multivar_horner-3.1.0.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
951bd6d55c327803adcba830877ca696c58921c7505d7bf4c535dc71e4383fe5
|
|
| MD5 |
ae7ca6c79ec63fe61ca3e595502f9e84
|
|
| BLAKE2b-256 |
3cd81aa486b3014ef556b772e0cad352a0e07cb5c06685ac7c3a969aa0030e5c
|
File details
Details for the file multivar_horner-3.1.0-py3-none-any.whl.
File metadata
- Download URL: multivar_horner-3.1.0-py3-none-any.whl
- Upload date:
- Size: 56.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
946fc1ae09c309237cfc0495e28e004e621009e5285235f8eea4d62d1cf274be
|
|
| MD5 |
8792f2faa2cd27b0d345eec7e01c413a
|
|
| BLAKE2b-256 |
b6e59418f4f0a6c2caca5d35e1bfe73bb383713f35665436300bd8ecd442210c
|