flopscope.numpy.imag
fnp.imag(val)[flopscope source][numpy source]
Return the imaginary part of the complex argument.
Adapted from NumPy docs np.imag
Cost
Flopscope Context
Return imaginary part of complex array.
Parameters
- val:array_like
Input array.
Returns
- out:ndarray or scalar
The imaginary component of the complex argument. If
valis real, the type ofvalis used for the output. Ifvalhas complex elements, the returned type is float.
See also
Examples
>>> import flopscope.numpy as fnp
>>> a = flops.array([1+2j, 3+4j, 5+6j])
>>> a.imag
array([2., 4., 6.])
>>> a.imag = flops.array([8, 10, 12])
>>> a
array([1. +8.j, 3.+10.j, 5.+12.j])
>>> flops.imag(1 + 1j)
1.0