ut3frame_to_t3frame#

t3toolbox.backend.ufv_conversions.ut3frame_to_t3frame(x)#
def ut3frame_to_t3frame(
        x: typ.Tuple[
            NDArray,                          # up_tucker_supercore
            NDArray,                          # down_tt_supercore
            NDArray,                          # left_tt_supercore
            NDArray,                          # right_tt_supercore
            typ.Tuple[int, ...],              # shape
            typ.Tuple[                        # (up_mask, down_mask, frame_left_mask, frame_right_mask)
                NDArray, NDArray, NDArray, NDArray,
            ],
        ],
) -> typ.Union[
    typ.Tuple[typ.Tuple[NDArray, ...], ...],  # (up_cores, down_cores, left_cores, right_cores), if unstacked
    typ.Tuple,                                # else a nested tree (shaped like stack_shape) of those
]:

Convert a uniform UT3Frame .data to ragged T3Frame core-tuples (or a nested tree, if stacked).

The physical mode dims are a contiguous prefix, so they slice [:Ni] (from the shape ints, no argwhere); only the rank masks scatter, so they are extracted with np.argwhere (HOST numpy – masks are host). The supercores may be jax; advanced-indexing them with the host int indices is fine.

Parameters:

x (t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray, t3toolbox.backend.common.typ.Tuple[int, Ellipsis], t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray, NDArray]])

Return type:

t3toolbox.backend.common.typ.Union[t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[NDArray, Ellipsis], Ellipsis], t3toolbox.backend.common.typ.Tuple]