real
Returns the real 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.real(a)
>>> o.todense()
array([[0., 2.],
[0., 3.]])
Source code in sparse/numba_backend/_common.py
3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 | |