dpnp.sort_complex

dpnp.sort_complex(a)[source]

Sort a complex array using the real part first, then the imaginary part.

For full documentation refer to numpy.sort_complex.

Parameters:

a ({dpnp.ndarray, usm_ndarray}) -- Input array.

Returns:

out -- Always returns a sorted complex array.

Return type:

dpnp.ndarray of complex dtype

Examples

>>> import dpnp as np
>>> a = np.array([5, 3, 6, 2, 1])
>>> np.sort_complex(a)
array([1.+0.j, 2.+0.j, 3.+0.j, 5.+0.j, 6.+0.j])
>>> a = np.array([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j])
>>> np.sort_complex(a)
array([1.+2.j, 2.-1.j, 3.-3.j, 3.-2.j, 3.+5.j])