cupynumeric.real_if_close#
- cupynumeric.real_if_close(a: ndarray, tol: float = 100) ndarray #
If input is complex with all imaginary parts close to zero, return real parts.
“Close to zero” is defined as tol * (machine epsilon of the type for a).
- Parameters:
a (array_like) – Input array.
tol (float, optional) – Tolerance in machine epsilons for the complex part of the elements in the array. If the tolerance is <=1, then the absolute tolerance is used. Default is 100.
- Returns:
out – If a is real, the type of a is used for the output. If a has complex elements, the returned type is float.
- Return type:
See also
Notes
Machine epsilon varies from machine to machine and between data types but Python floats on most platforms have a machine epsilon equal to 2.2204460492503131e-16. You can use ‘np.finfo(float).eps’ to print out the machine epsilon for floats.
- Availability:
Multiple GPUs, Multiple CPUs