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 floating-point data types. Both inputs x1 and x2 can not be scalars at the same time.
x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Array of exponents of two, expected to have an integer data type. Both inputs x1 and x2 can not be scalars at the same time. If
x1.shape != x2.shape
, they must be broadcastable to a common shape (which becomes the shape of the output).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 ({"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
NotImplementedError
exception will be raised.See also
dpnp.frexp
Return (y1, y2) from
x = y1 * 2**y2
, inverse todpnp.ldexp
.
Notes
Complex dtypes are not supported, they will raise a
TypeError
.dpnp.ldexp
is useful as the inverse ofdpnp.frexp
, if used by itself it is more clear to simply use the expressionx1 * 2**x2
.Examples
>>> import dpnp as np >>> np.ldexp(5, np.arange(4)) array([ 5., 10., 20., 40.])