numpy.sort_complex

numpy.sort_complex(a)

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

Parameters:

a : array_like

Input array

Returns:

out : complex ndarray

Always returns a sorted complex array.

Examples

>>> np.sort_complex([5, 3, 6, 2, 1])
array([ 1.+0.j,  2.+0.j,  3.+0.j,  5.+0.j,  6.+0.j])
>>> np.sort_complex([5 + 2j, 3 - 1j, 6 - 2j, 2 - 3j, 1 - 5j])
array([ 1.-5.j,  2.-3.j,  3.-1.j,  5.+2.j,  6.-2.j])

Previous topic

numpy.msort

Next topic

numpy.argmax

This Page

Quick search