t3_rank_adjustment_sweep#

t3toolbox.backend.t3_svd.t3_rank_adjustment_sweep(x, direction='right_to_left', sharing=None)#
def t3_rank_adjustment_sweep(
        x: typ.Tuple[
            typ.Tuple[NDArray, ...],  # tucker_cores
            typ.Tuple[NDArray, ...],  # tt_cores
        ],
        direction: str = 'right_to_left',  # 'right_to_left' | 'left_to_right'
        sharing:   typ.Sequence = None,    # len=d, static; group labels (None = unshared)
) -> typ.Tuple[
    typ.Tuple[NDArray, ...],  # tucker_cores
    typ.Tuple[NDArray, ...],  # tt_cores
]:

A single lossless directional sweep that drops structurally-redundant ranks (re-SVD each Tucker edge and TT bond with no cap). The represented tensor is unchanged.

'right_to_left' produces a right-orthogonal result; 'left_to_right' a left-orthogonal one – in the full sense (Tucker cores orthonormal too) when the input’s Tucker cores are already orthonormal, e.g. any t3svd() result: the sweep re-SVDs the TT cores and their bonds and preserves Tucker orthonormality (Q <- V^T Q keeps orthonormal rows), it never re-orthonormalizes a Tucker core. On a generic input the TT cores come out orthogonal and the Tucker cores stay as they were (so is_right_orthogonal is False and t3svd(assume_orthogonal=True) would be wrong on it). A single sweep reaches the minimal ranks only if the input is already orthogonal in the opposite direction – e.g. a t3svd() result is left-orthogonal, so t3_rank_adjustment_sweep(result, 'right_to_left') minimizes it (verify with has_minimal_ranks). On a general input it is a partial reduction; compose both directions for guaranteed minimal ranks (a Tucker rank above its mode size, n_i > N_i, is reduced by a Tucker up-SVD first – the one case the TT-side steps cannot see).

sharing: a partition with a real group routes through the grouped lossless reduction (_t3svd_shared() with no caps – the per-mode Tucker step would untie the group). The group Tucker rank drops to the STRUCTURAL rank of the concatenated centers, min(n_g, sum_i rL_i * rR_i) – which may exceed an individual mode’s rL_i * rR_i (the group ceiling; that is not a reducible redundancy). Direction and orthogonality contracts are as above ('right_to_left' is implemented by mode reversal); the same compose-both-directions rule gives guaranteed shared-minimal ranks. sharing=None and all-singleton partitions run the literal unshared sweep.

Parameters:
  • x (t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[NDArray, ...], t3toolbox.backend.common.typ.Tuple[NDArray, ...]])

  • direction (str)

  • sharing (t3toolbox.backend.common.typ.Sequence)

Return type:

t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[NDArray, …], t3toolbox.backend.common.typ.Tuple[NDArray, …]]