[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../c-api/../generated/numpy.sort_complex.html [Back]  [Original]

numpy.sort_complex — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.sort_complex#

numpy.sort_complex(a)[source]#

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

Parameters:
aarray_like

Input array

Returns:
outcomplex ndarray

Always returns a sorted complex array.

Examples

Try it in your browser!
>>> import numpy as np
>>> 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([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j])
array([1.+2.j,  2.-1.j,  3.-3.j,  3.-2.j,  3.+5.j])

Web Proxy Viewer  |  New URL  |  Original Page