Internal implementation of block based on repeated concatenation. `arrays` is the argument passed to block. `max_depth` is the depth of nested lists within `arrays` and `result_ndim` is the greatest of the dimensions of the arrays in `arrays` and the depth of the lists in `array
(arrays, max_depth, result_ndim, depth=0)
| 746 | |
| 747 | |
| 748 | def _block(arrays, max_depth, result_ndim, depth=0): |
| 749 | """ |
| 750 | Internal implementation of block based on repeated concatenation. |
| 751 | `arrays` is the argument passed to |
| 752 | block. `max_depth` is the depth of nested lists within `arrays` and |
| 753 | `result_ndim` is the greatest of the dimensions of the arrays in |
| 754 | `arrays` and the depth of the lists in `arrays` (see block docstring |
| 755 | for details). |
| 756 | """ |
| 757 | if depth < max_depth: |
| 758 | arrs = [_block(arr, max_depth, result_ndim, depth + 1) |
| 759 | for arr in arrays] |
| 760 | return _concatenate(arrs, axis=-(max_depth - depth)) |
| 761 | else: |
| 762 | # We've 'bottomed out' - arrays is either a scalar or an array |
| 763 | # type(arrays) is not list |
| 764 | return _atleast_nd(arrays, result_ndim) |
| 765 | |
| 766 | |
| 767 | def _block_dispatcher(arrays): |
no test coverage detected
searching dependent graphs…