jax.numpy.isrealobj#

jax.numpy.isrealobj(x)[source]#

Check if the input is not a complex number or an array containing complex elements.

JAX implementation of numpy.isrealobj().

The function evaluates based on input type rather than value. Inputs with zero imaginary parts are still considered complex.

Parameters:

x (Any) – input object to check.

Returns:

False if x is a complex number or an array containing at least one complex element, True otherwise.

Return type:

bool

Examples

>>> jnp.isrealobj(0)
True
>>> jnp.isrealobj(1.2)
True
>>> jnp.isrealobj(jnp.array([1, 2]))
True
>>> jnp.isrealobj(1+2j)
False
>>> jnp.isrealobj(jnp.array([0, 1+2j]))
False