dpnp.ediff1d

dpnp.ediff1d(x1, to_end=None, to_begin=None)[source]

The differences between consecutive elements of an array.

For full documentation refer to numpy.ediff1d.

Limitations

Parameter x1`is supported as :class:`dpnp.ndarray. Keyword arguments to_end and to_begin are currently supported only with default values None. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP Available array data types.

See also

dpnp.diff

Calculate the n-th discrete difference along the given axis.

Examples

>>> import dpnp as np
>>> a = np.array([1, 2, 4, 7, 0])
>>> result = np.ediff1d(a)
>>> [x for x in result]
[1, 2, 3, -7]
>>> b = np.array([[1, 2, 4], [1, 6, 24]])
>>> result = np.ediff1d(b)
>>> [x for x in result]
[1, 2, -3, 5, 18]