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

Function frexp

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

Source from the content-addressed store, hash-verified

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