t3_absorb_tucker_into_tt#

t3toolbox.backend.t3_operations.t3_absorb_tucker_into_tt(tucker_cores, tt_cores)#
def t3_absorb_tucker_into_tt(
        tucker_cores: typ.Union[
            typ.Sequence[NDArray],  # ragged:  len=d, elm_shape=stack_shape+(ni, Ni)
            NDArray,                # uniform: shape=(d,)+stack_shape+(ni, Ni)
        ],
        tt_cores: typ.Union[
            typ.Sequence[NDArray],  # ragged:  len=d, elm_shape=stack_shape+(ri, ni, r(i+1))
            NDArray,                # uniform: shape=(d,)+stack_shape+(ri, ni, r(i+1))
        ],
) -> typ.Union[
    typ.Tuple[NDArray, ...],  # ragged:  big TT cores, elm_shape=stack_shape+(ri, Ni, r(i+1))
    NDArray,                  # uniform: big TT supercore, shape=(d,)+stack_shape+(r, N, r)
]:

Absorb each Tucker core into its TT core, replacing the mode (n) leg with the physical (N) leg: big_tt[...,a,o,b] = sum_n tt[...,a,n,b] * tucker[...,n,o].

Representation-agnostic: a single batched einsum over (d,)+stack for a uniform supercore (the vectorization win), a per-core list-comp for ragged tuples. The opening step of both t3_to_dense() (t3_to_dense_chain) and the inner-product/norm zipper.

Parameters:
  • tucker_cores (t3toolbox.backend.common.typ.Union[t3toolbox.backend.common.typ.Sequence[NDArray], NDArray])

  • tt_cores (t3toolbox.backend.common.typ.Union[t3toolbox.backend.common.typ.Sequence[NDArray], NDArray])

Return type:

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