imag
Returns the imaginary component of a complex number for each element x_i
of the input array x
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
input array of a complex floating-point data type. |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
array
|
an array containing the element-wise results.
The returned array has a floating-point data type with the same floating-point precision as |
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0 + 1j, 2 + 0j], [0 + 0j, 3 + 1j]]))
>>> o = sparse.imag(a)
>>> o.todense()
array([[1., 0.],
[0., 1.]])
Source code in sparse/numba_backend/_common.py
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 |
|