T3Tangent.align_padded#
- t3toolbox.manifold.T3Tangent.align_padded(old_tucker_ranks, old_tt_ranks, tucker_ranks=None, tt_ranks=None, sharing=None, update=('D', 'U', 'L', 'R'))#
def align_padded( self, old_tucker_ranks: typ.Sequence[int], # len=d; the zero tensor: (0,)*d old_tt_ranks: typ.Sequence[int], # len=d+1; the zero tensor: (1, 0, ..., 0, 1) tucker_ranks: typ.Optional[typ.Sequence[int]] = None, # len=d, output; None = the frame's own tt_ranks: typ.Optional[typ.Sequence[int]] = None, # len=d+1, output; None = the frame's own sharing: typ.Optional[typ.Sequence] = None, # len=d group labels; None = unshared update: typ.Collection[str] = ('D', 'U', 'L', 'R'), # store letters, any order: 'D' down, 'U' up, 'L' left, 'R' right; the rest transported ) -> typ.Tuple[ 'bvf.T3Frame', # the aligned frame NDArray, # movement, shape = frame stack C ]:
One alignment step of this tangent’s padded frame: every new slot replaced by this tangent’s leading new directions, the old blocks (
old_*_ranks) held fixed.The frame must be a padded frame of a point at the old ranks (e.g.
padded());fv_aligned_padded_frame()loops this step. The movement measures how far the new slots turned (0 at a fixed point).updaterestricts the step to some stores, transporting the others (('D', 'L')/('U', 'R')are the two colours of the loop); output ranks below the frame’s truncate.At a fixed point of the loop every store’s completion spans the leading directions of its content, so one more step moves nothing: the loop twin’s docstring demonstrates it. See The aligned padded frame.
Examples
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.frame_variations_format as bvf >>> import t3toolbox.manifold as t3m >>> np.random.seed(0) >>> x_old = t3.TuckerTensorTrain.randn((5, 6, 5), (2, 2, 2), (1, 2, 2, 1)) >>> F = bvf.T3Frame.padded(x_old, (3, 4, 3), (1, 3, 3, 1)) >>> v = t3m.MANIFOLD.project_ambient(F, t3.TuckerTensorTrain.randn((5, 6, 5), (5, 6, 5), (1, 5, 5, 1))) >>> F1, movement = v.align_padded((2, 2, 2), (1, 2, 2, 1)) >>> F1.down_ranks, bool(F1.is_orthogonal()), float(movement) > 0 ((3, 4, 3), True, True)
- Parameters:
old_tucker_ranks (t3toolbox.backend.common.typ.Sequence[int])
old_tt_ranks (t3toolbox.backend.common.typ.Sequence[int])
tucker_ranks (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence[int]])
tt_ranks (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence[int]])
sharing (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence])
update (t3toolbox.backend.common.typ.Collection[str])
- Return type: