UT3Frame.padded#

static t3toolbox.uniform_frame_variations_format.UT3Frame.padded(x_old, tucker_ranks, tt_ranks, sharing=None, seed=ZERO_FRAME_SEED)#
def padded(
        x_old:         'ut3.UniformTuckerTensorTrain',             # the old point (reduced to minimal ranks here); rank 0 = the zero tensor
        tucker_ranks:  typ.Union[typ.Sequence[int], NDArray],      # len=d, or HOST int (d,)+C, target
        tt_ranks:      typ.Union[typ.Sequence[int], NDArray],      # len=d+1, or HOST int (d+1,)+C, target

        sharing:       typ.Optional[typ.Sequence] = None,          # len=d group labels; None = unshared
        seed:          int = ZERO_FRAME_SEED,                      # the keyed seed streams of the completions
) -> typ.Tuple[
    'UT3Frame',            # the hint-free padded frame in block layout
    typ.Tuple[int, int],   # split (Na, Rb), for UT3Tangent.align_padded
]:

The hint-free padded frame of x_old at larger ranks, in block layout: the uniform twin of padded().

Every rank slot is [old block | new block]: x_old’s own frame as its orthogonal representation gives it, then the completion, each with its own mask (the masks are the only truth: gappy patterns are fine). The split (Na, Rb) – the old block’s Tucker and bond widths – is what align_padded() needs. Target ranks may vary per stack element. x_old is reduced to minimal ranks first; a structurally zero x_old is the zero tensor (empty frame).

The completions use the same Gaussian, slot-indexed seeds as the ragged twin, so a start is a function of the old frame’s representation, slot signs included. The uniform and ragged representations of one point can pick different signs, so their starts can differ, while the aligned loop’s output agrees to its tolerance. See The aligned padded frame.

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.uniform_tucker_tensor_train as ut3
>>> import t3toolbox.uniform_frame_variations_format as ubv
>>> np.random.seed(0)
>>> x_old = ut3.UniformTuckerTensorTrain.from_t3(t3.TuckerTensorTrain.randn((5, 6, 5), (2, 2, 2), (1, 2, 2, 1)))
>>> F, split = ubv.UT3Frame.padded(x_old, (3, 4, 3), (1, 3, 3, 1))
>>> split, F.masks.down_mask.sum(axis=-1).tolist(), bool(F.is_orthogonal())
((2, 2), [3, 4, 3], True)
Parameters:
  • x_old (UniformTuckerTensorTrain)

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

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

  • sharing (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence])

  • seed (int)

Return type:

t3toolbox.backend.common.typ.Tuple[UT3Frame, t3toolbox.backend.common.typ.Tuple[int, int]]