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)
| 671 | |
| 672 | |
| 673 | def _block(arrays, max_depth, result_ndim, depth=0): |
| 674 | """ |
| 675 | Internal implementation of block based on repeated concatenation. |
| 676 | `arrays` is the argument passed to |
| 677 | block. `max_depth` is the depth of nested lists within `arrays` and |
| 678 | `result_ndim` is the greatest of the dimensions of the arrays in |
| 679 | `arrays` and the depth of the lists in `arrays` (see block docstring |
| 680 | for details). |
| 681 | """ |
| 682 | if depth < max_depth: |
| 683 | arrs = [_block(arr, max_depth, result_ndim, depth+1) |
| 684 | for arr in arrays] |
| 685 | return _concatenate(arrs, axis=-(max_depth-depth)) |
| 686 | else: |
| 687 | # We've 'bottomed out' - arrays is either a scalar or an array |
| 688 | # type(arrays) is not list |
| 689 | return _atleast_nd(arrays, result_ndim) |
| 690 | |
| 691 | |
| 692 | def _block_dispatcher(arrays): |
no test coverage detected