dpnp.rint

dpnp.rint(x, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Round elements of the array to the nearest integer.

For full documentation refer to numpy.rint.

Parameters:
  • x ({dpnp.ndarray, usm_ndarray}) – Input array, expected to have numeric data type.

  • out ({None, dpnp.ndarray}, optional) – Output array to populate. Array must have the correct shape and the expected data type.

  • order ({"C", "F", "A", "K"}, optional) – Memory layout of the newly output array, if parameter out is None. Default: “K”.

Returns:

out – An array containing the element-wise rounded value. The data type of the returned array is determined by the Type Promotion Rules.

Return type:

dpnp.ndarray

Limitations

Keyword argument kwargs is currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.round

Evenly round to the given number of decimals.

dpnp.ceil

Compute the ceiling of the input, element-wise.

dpnp.floor

Return the floor of the input, element-wise.

dpnp.trunc

Return the truncated value of the input, element-wise.

Examples

>>> import dpnp as np
>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
>>> np.rint(a)
array([-2., -2., -0.,  0.,  2.,  2.,  2.])