cyjax.polynomial.compute_monomials#

cyjax.polynomial.compute_monomials(values, coeffs, powers, *, opt=True, log=True, symbolic=False)#

Compute monomial terms of a polynomial.

Setting log=True appears to lead to slightly faster computation. Using opt=True only leads to a speedup if there are powers == 0. In that case, the value can be skipped and replaced by 1 without computation.

Parameters:
  • values – Tuple of values (variables). Each can have rank 0 (for scalars) or rank 2 (for vector variables).

  • coeffs – Sequence (1D) of coefficients for each monomial.

  • powers – Tuple of powers for each variable. The first index ranges over the included variables, the second over the monomials, and the third over the indices of the variables.

  • log – Whether to use exp(power * log(var)) for computation.

  • opt – Whether to use an evaluation structure that avoids computations where power==0. This is needed for numeric reasons when log is true, thus the argument is ignored in that case.

  • symbolic – Indicates the inputs are symbolic and not purely numerical. If so, both log and opt are ignored.

Returns:

Array of monomials evaluated for given values.