Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.sort_complex

jax.numpy.sort_complex#

jax.numpy.sort_complex(a)[source]#

Return a sorted copy of complex array.

JAX implementation ofnumpy.sort_complex().

Complex numbers are sorted lexicographically, meaning by their real partfirst, and then by their imaginary part if real parts are equal.

Parameters:

a (Array |ndarray |bool |number |bool |int |float |complex |TypedNdArray) – input array. If dtype is not complex, the array will be upcast to complex.

Returns:

A sorted array of the same shape and complex dtype as the input. Ifais multi-dimensional, it is sorted along the last axis.

Return type:

Array

See also

Examples

>>>a=jnp.array([1+2j,2+4j,3-1j,2+3j])>>>jnp.sort_complex(a)Array([1.+2.j, 2.+3.j, 2.+4.j, 3.-1.j], dtype=complex64)

Multi-dimensional arrays are sorted along the last axis:

>>>a=jnp.array([[5,3,4],...[6,9,2]])>>>jnp.sort_complex(a)Array([[3.+0.j, 4.+0.j, 5.+0.j],       [2.+0.j, 6.+0.j, 9.+0.j]], dtype=complex64)

[8]ページ先頭

©2009-2025 Movatter.jp