(arrays, list_ndim, result_ndim)
| 967 | |
| 968 | |
| 969 | def _block_slicing(arrays, list_ndim, result_ndim): |
| 970 | shape, slices, arrays = _block_info_recursion( |
| 971 | arrays, list_ndim, result_ndim) |
| 972 | dtype = _nx.result_type(*[arr.dtype for arr in arrays]) |
| 973 | |
| 974 | # Test preferring F only in the case that all input arrays are F |
| 975 | F_order = all(arr.flags['F_CONTIGUOUS'] for arr in arrays) |
| 976 | C_order = all(arr.flags['C_CONTIGUOUS'] for arr in arrays) |
| 977 | order = 'F' if F_order and not C_order else 'C' |
| 978 | result = _nx.empty(shape=shape, dtype=dtype, order=order) |
| 979 | # Note: In a c implementation, the function |
| 980 | # PyArray_CreateMultiSortedStridePerm could be used for more advanced |
| 981 | # guessing of the desired order. |
| 982 | |
| 983 | for the_slice, arr in zip(slices, arrays): |
| 984 | result[(Ellipsis,) + the_slice] = arr |
| 985 | return result |
| 986 | |
| 987 | |
| 988 | def _block_concatenate(arrays, list_ndim, result_ndim): |
searching dependent graphs…