flopscope.

flopscope.numpy.iscomplexobj

Check for a complex type or an array of complex numbers.

Adapted from NumPy docs np.iscomplexobj

Areacore
Typefree
Cost
0
Flopscope Context

Return True if input is a complex type or array (dtype predicate, O(1)).

The type of the input is checked, not the value. Even if the input has an imaginary part equal to zero, iscomplexobj evaluates to True.

Parameters

x:any

The input can be of any type and shape.

Returns

iscomplexobj:bool

The return value, True if x is of a complex type or has at least one complex element.

See also

Examples

>>> import flopscope.numpy as fnp
>>> flops.iscomplexobj(1)
False
>>> flops.iscomplexobj(1+0j)
True
>>> flops.iscomplexobj([3, 1+0j, True])
True