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

Function divide_to_width

dask/array/rechunk.py:432–444  ·  view source on GitHub ↗

Minimally divide the given chunks so as to make the largest chunk width less or equal than *max_width*.

(desired_chunks, max_width)

Source from the content-addressed store, hash-verified

430
431
432def divide_to_width(desired_chunks, max_width):
433 """Minimally divide the given chunks so as to make the largest chunk
434 width less or equal than *max_width*.
435 """
436 chunks = []
437 for c in desired_chunks:
438 nb_divides = int(np.ceil(c / max_width))
439 for i in range(nb_divides):
440 n = c // (nb_divides - i)
441 chunks.append(n)
442 c -= n
443 assert c == 0
444 return tuple(chunks)
445
446
447def merge_to_number(desired_chunks, max_number):

Callers 2

test_divide_to_widthFunction · 0.90
find_merge_rechunkFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_divide_to_widthFunction · 0.72