A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.jax.dev/en/latest/_autosummary/jax.numpy.polydiv.html below:

jax.numpy.polydiv — JAX documentation

jax.numpy.polydiv#
jax.numpy.polydiv(u, v, *, trim_leading_zeros=False)[source]#

Returns the quotient and remainder of polynomial division.

JAX implementation of numpy.polydiv().

Parameters:
  • u (ArrayLike) – Array of dividend polynomial coefficients.

  • v (ArrayLike) – Array of divisor polynomial coefficients.

  • trim_leading_zeros (bool) – Default is False. If True removes the leading zeros in the return value to match the result of numpy. But prevents the function from being able to be used in compiled code. Due to differences in accumulation of floating point arithmetic errors, the cutoff for values to be considered zero may lead to inconsistent results between NumPy and JAX, and even between different JAX backends. The result may lead to inconsistent output shapes when trim_leading_zeros=True.

Returns:

A tuple of quotient and remainder arrays. The dtype of the output is always promoted to inexact.

Return type:

tuple[Array, Array]

Examples

>>> x1 = jnp.array([5, 7, 9])
>>> x2 = jnp.array([4, 1])
>>> np.polydiv(x1, x2)
(array([1.25  , 1.4375]), array([7.5625]))
>>> jnp.polydiv(x1, x2)
(Array([1.25  , 1.4375], dtype=float32), Array([0.    , 0.    , 7.5625], dtype=float32))

If trim_leading_zeros=True, the result matches with np.polydiv’s.

>>> jnp.polydiv(x1, x2, trim_leading_zeros=True)
(Array([1.25  , 1.4375], dtype=float32), Array([7.5625], dtype=float32))

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4