newton.eval#
- minterpy.jit_compiled.newton.eval.eval_newton_monomials_single(x_single, exponents, generating_points, max_exponents, products_placeholder, monomials_placeholder)[source]#
Precomputes the value of all given Newton basis polynomials at a point.
Core of the fast polynomial evaluation algorithm. -
m
spatial dimension -N
number of monomials -n
maximum exponent in each dimension- Parameters:
x_single – coordinates of the point. The shape has to be
m
.exponents – numpy array with exponents for the polynomial. The shape has to be
(N x m)
.generating_points – generating points used to generate the grid. The shape is
(n x m)
.max_exponents – array with maximum exponent in each dimension. The shape has to be
m
.products_placeholder – a numpy array for storing the (chained) products.
monomials_placeholder – a numpy array of length N for storing the values of all Newton basis polynomials.
- Return type:
None
Notes
This is a Numba-accelerated function.
The function precompute all the (chained) products required during Newton evaluation for a single query point with complexity of
O(mN)
.The (pre-)computation of Newton monomials is coefficient agnostic.
Results are stored in the placeholder arrays. The function returns None.
- minterpy.jit_compiled.newton.eval.eval_newton_monomials_multiple(xx, exponents, generating_points, max_exponents, products_placeholder, monomials_placeholder, triangular)[source]#
Evaluate the Newton monomials at multiple query points.
The following notations are used below:
\(m\): the spatial dimension of the polynomial
\(p\): the (maximum) degree of the polynomial in any dimension
\(n\): the number of elements in the multi-index set (i.e., monomials)
\(\mathrm{nr_{points}}\): the number of query (evaluation) points
\(\mathrm{nr_polynomials}\): the number of polynomials with different coefficient sets of the same multi-index set
- Parameters:
xx (ndarray) – numpy array with coordinates of points where polynomial is to be evaluated. The shape has to be
(k x m)
.exponents (ndarray) – numpy array with exponents for the polynomial. The shape has to be
(N x m)
.generating_points (ndarray) – generating points used to generate the grid. The shape is
(n x m)
.max_exponents (ndarray) – array with maximum exponent in each dimension. The shape has to be
m
.products_placeholder (ndarray) – a numpy array for storing the (chained) products.
monomials_placeholder (ndarray) – placeholder numpy array where the results of evaluation are stored. The shape has to be
(k x p)
.triangular (bool) – whether the output will be of lower triangular form or not. -> will skip the evaluation of some values
- Returns:
the value of each Newton polynomial at each point. The shape will be
(k x N)
.- Return type:
None
Notes
This is a Numba-accelerated function.
The memory footprint for evaluating the Newton monomials iteratively with a single query point at a time is smaller than evaluating all the Newton monomials on all query points. However, when multiplied with multiple coefficient sets, this approach will be faster.
Results are stored in the placeholder arrays. The function returns None.