tt_squash_tails =============== .. py:function:: t3toolbox.backend.tt_operations.tt_squash_tails(tt_cores) .. code-block:: python def tt_squash_tails( tt_cores: typ.Union[ typ.Sequence[NDArray], # ragged. len=d, elm_shape=stack_shape+(rLi,ni,rR(i+1)) NDArray, # uniform. shape=(d,)+stack_shape+(r,n,r) ], ) -> typ.Union[ typ.Tuple[NDArray, ...], # ragged: r0=rd=1. len=d, elm_shape=stack_shape+(1,n0,r1),...,(r(d-1),n(d-1),1) NDArray, # uniform: same shape, boundary bond summed into slot 0, rest zeroed ]: Collapse the leading and trailing TT bonds to one without changing the represented tensor. Ragged cores shrink to boundary bond 1; a uniform supercore keeps its shape (the bond is summed into slot 0 and the remaining slots zeroed, so the boundary rank *mask* becomes 1).