bundles / numpy latest / numpy / lib / _scimath_impl / _tocomplex
function
numpy.lib._scimath_impl:_tocomplex
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_scimath_impl.py :32
Signature
def _tocomplex ( arr ) Summary
Convert its input arr to a complex array.
Extended Summary
The input is returned as a complex array of the smallest type that will fit the original data: types like single, byte, short, etc. become csingle, while others become cdouble.
A copy of the input is always made.
Parameters
arr: array
Returns
: arrayAn array with the same input data as the input but in complex form.
Examples
import numpy as np
✓a = np.array([1,2,3],np.short)
✓ac = np.lib.scimath._tocomplex(a); ac
⚠ac.dtype
⚠b = np.array([1,2,3],np.double)
✓bc = np.lib.scimath._tocomplex(b); bc
⚠bc.dtype
⚠c = np.array([1,2,3],np.csingle)
✓cc = np.lib.scimath._tocomplex(c); cc
⚠c *= 2; c
✗cc
⚠Aliases
-
numpy.lib._scimath_impl._tocomplex