dpnp.ldexp
- dpnp.ldexp(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Returns \(x1 * 2^{x2}\), element-wise.
The mantissas x1 and exponents of two x2 are used to construct floating-point numbers \(x1 * 2^{x2}\).
For full documentation refer to
numpy.ldexp.- Parameters:
x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- Array of multipliers, expected to have a real-valued floating-point data type.
x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Array of exponents of two, expected to have an integer data type.
out ({None, dpnp.ndarray, usm_ndarray}, optional) --
Output array to populate. Array must have the correct shape 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:
out -- The result of \(x1 * 2^{x2}\).
- Return type:
dpnp.ndarray
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.frexpReturn (y1, y2) from \(x = y1 * 2^{y2}\), inverse to
dpnp.ldexp.
Notes
At least one of x1 or x2 must be an array.
If
x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).Complex dtypes are not supported, they will raise a
TypeError.dpnp.ldexpis useful as the inverse ofdpnp.frexp, if used by itself it is more clear to simply use the expression \(x1 * 2^{x2}\).Examples
>>> import dpnp as np >>> np.ldexp(5, np.arange(4)) array([ 5., 10., 20., 40.])