MCPcopy Create free account
hub / github.com/dask/dask / frexp

Function frexp

dask/array/ufunc.py:297–318  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

295
296@derived_from(np)
297def frexp(x):
298 # Not actually object dtype, just need to specify something
299 tmp = elemwise(np.frexp, x, dtype=object)
300 left = "mantissa-" + tmp.name
301 right = "exponent-" + tmp.name
302 ldsk = {
303 (left,) + key[1:]: (getitem, key, 0)
304 for key in core.flatten(tmp.__dask_keys__())
305 }
306 rdsk = {
307 (right,) + key[1:]: (getitem, key, 1)
308 for key in core.flatten(tmp.__dask_keys__())
309 }
310
311 a = np.empty_like(getattr(x, "_meta", x), shape=(1,) * x.ndim, dtype=x.dtype)
312 l, r = np.frexp(a)
313
314 graph = HighLevelGraph.from_collections(left, ldsk, dependencies=[tmp])
315 L = Array(graph, left, chunks=tmp.chunks, meta=l)
316 graph = HighLevelGraph.from_collections(right, rdsk, dependencies=[tmp])
317 R = Array(graph, right, chunks=tmp.chunks, meta=r)
318 return L, R
319
320
321@derived_from(np)

Callers

nothing calls this directly

Calls 5

elemwiseFunction · 0.90
ArrayClass · 0.90
flattenMethod · 0.80
from_collectionsMethod · 0.80
__dask_keys__Method · 0.45

Tested by

no test coverage detected