Internal utility for cumulative sum with label. >>> cumdims_label(((5, 3, 3), (2, 2, 1)), 'n') # doctest: +NORMALIZE_WHITESPACE [(('n', 0), ('n', 5), ('n', 8), ('n', 11)), (('n', 0), ('n', 2), ('n', 4), ('n', 5))]
(chunks, const)
| 31 | |
| 32 | |
| 33 | def cumdims_label(chunks, const): |
| 34 | """Internal utility for cumulative sum with label. |
| 35 | |
| 36 | >>> cumdims_label(((5, 3, 3), (2, 2, 1)), 'n') # doctest: +NORMALIZE_WHITESPACE |
| 37 | [(('n', 0), ('n', 5), ('n', 8), ('n', 11)), |
| 38 | (('n', 0), ('n', 2), ('n', 4), ('n', 5))] |
| 39 | """ |
| 40 | return [ |
| 41 | tuple(zip((const,) * (1 + len(bds)), accumulate(add, (0,) + bds))) |
| 42 | for bds in chunks |
| 43 | ] |
| 44 | |
| 45 | |
| 46 | def _breakpoints(cumold, cumnew): |
no outgoing calls
searching dependent graphs…