__abs__

array.__abs__() array

Calculates the absolute value for each element of an array instance.

For real-valued input arrays, the element-wise result has the same magnitude as the respective element in x but has positive sign.

Note

For signed integer data types, the absolute value of the minimum representable integer is implementation-dependent.

Parameters:

self (array) – array instance. Should have a numeric data type.

Returns:

out (array) – an array containing the element-wise absolute value. If self has a real-valued data type, the returned array must have the same data type as self. If self has a complex floating-point data type, the returned arrayed must have a real-valued floating-point data type whose precision matches the precision of self (e.g., if self is complex128, then the returned array must have a float64 data type).

Notes

Note

Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function abs().

Changed in version 2022.12: Added complex data type support.