dpnp.frexp
- dpnp.frexp = <DPNPUnaryTwoOutputsFunc '_frexp'>
Decompose each element \(x_i\) of the input array x into the mantissa and the twos exponent.
For full documentation refer to
numpy.frexp.- Parameters:
x ({dpnp.ndarray, usm_ndarray}) -- Array of numbers to be decomposed, expected to have a real-valued floating-point data type.
out1 ({None, dpnp.ndarray, usm_ndarray}, optional) --
Output array for the mantissa to populate. Array must have the same shape as x and the expected data type.
Default:
None.out2 ({None, dpnp.ndarray, usm_ndarray}, optional) --
Output array for the exponent to populate. Array must have the same shape as x and the expected data type.
Default:
None.order ({None, "C", "F", "A", "K"}, optional) --
Memory layout of the newly output array, if parameter out is
None.Default:
"K".
- Returns:
mantissa (dpnp.ndarray) -- Floating values between -1 and 1.
exponent (dpnp.ndarray) -- Integer exponents of 2.
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedErrorexception will be raised.See also
dpnp.ldexpCompute \(y = x1 * 2^{x2}\), inverse to
dpnp.frexp.
Notes
Complex dtypes are not supported, they will raise a
TypeError.Examples
>>> import dpnp as np >>> x = np.arange(9) >>> y1, y2 = np.frexp(x) >>> y1 array([0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875, 0.5 ]) >>> y2 array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32) >>> y1 * 2**y2 array([0., 1., 2., 3., 4., 5., 6., 7., 8.])