flopscope.

flopscope.numpy.iscomplex

Returns a bool array, where True if input element is complex.

Adapted from NumPy docs np.iscomplex

Areacore
Typecounted
NumPy Refnp.iscomplex
Cost
numel(output)\text{numel}(\text{output})
Flopscope Context

Test if element is complex element-wise.

What is tested is whether the input has a non-zero imaginary part, not if the input type is complex.

Parameters

x:array_like

Input array.

Returns

out:ndarray of bools

Output array.

See also

Examples

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