ufv_tied_lift_factors#

t3toolbox.backend.ufv_operations.ufv_tied_lift_factors(frame_data, curvature_damping, shared_data, rcond=None)#
def ufv_tied_lift_factors(
        frame_data:         typ.Tuple[
            NDArray,                                    # down_tucker_supercore,  (d,)+C+(nD, N)
            NDArray,                                    # up_tt_supercore,        (d,)+C+(rL, nU, rR)
            NDArray,                                    # left_tt_supercore,      (d,)+C+(rL, nD, rL)
            NDArray,                                    # right_tt_supercore,     (d,)+C+(rR, nD, rR)
            typ.Tuple[int, ...],                        # shape
            typ.Tuple[NDArray, NDArray, NDArray, NDArray],  # (down, up, frame_left, frame_right) masks; HOST bool
        ],
        curvature_damping:  typ.Union[float, NDArray],  # RELATIVE: eps = curvature_damping * ||X||_HS, >= 0
        shared_data:        sharing_module.SharedFrameData,  # the frame's UNIFORM companion (ufv_shared_frame_data)
        rcond:              typ.Optional[float] = None, # relative clip; None -> the ragged default per REAL block
) -> fv_operations.LiftFactors:                         # supercore-valued; shared_data + one tied filter per group

The uniform twin of fv_tied_lift_factors(): the lift factors of a uniform SHARED point – ufv_lift_factors() plus, per nontrivial sharing group, the damped filter of the group’s tied solve – so that utv_corewise_lift() lifts each group’s Tucker slots to ONE factor direction, Bdot_g = M_g^{+eps} [V_i1; ...], solved against the companion’s stacked-S SVD (ufv_shared_frame_data()).

The padded levels. The uniform companion is built on the frame’s padded supercores, so its group spectrum s_g carries, beyond the group’s real levels, padded levels that the SVD does not guarantee to be exact zeros (roundoff, or garbage in a hand-built companion). The filter f(s_g) = s_g / (s_g^2 + eps^2) (filtered_reciprocal()) is therefore zeroed on every padded level by the host masks (the group’s real level count is min(sum_i nU_i, nD) per stack element), not only by its relative clip; and the clip itself (rcond=None) is the ragged one, dtype eps * max(sum_i nU_i, nD), at the REAL dimensions. So per stack element the filter is the ragged filter on the real levels and exactly 0 beyond them, and the tied lift is the ragged one. A real level that is zero – a zero-padded warm start’s new level – is clipped to 0 like the ragged one, and stays a real level (the smallest lift singular value reports it).

The per-mode fields are ufv_lift_factors()’s, bit for bit (a group mode’s entries go unused). Requires an orthogonal frame and its own uniform companion (check-free; the lift checks the companion’s layout). Dispatch is inferred; the masks stay host numpy.

Examples

On a frame packed from a ragged shared one, the filter is the ragged filter on the real levels and exactly 0 on the padded ones, and the lift ties the group’s slices:

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.backend.fv_conversions as fvc
>>> import t3toolbox.backend.sharing as sharing
>>> import t3toolbox.backend.ufv_conversions as ufc
>>> import t3toolbox.backend.ufv_operations as ufo
>>> import t3toolbox.backend.utv_operations as utvo
>>> np.random.seed(0)
>>> x = t3.TuckerTensorTrain.randn((6, 6, 4), (4, 4, 2), (1, 2, 2, 1))
>>> x = sharing.t3_tie_tucker_factors(x.data, (0, 0, 1))                      # a tied point
>>> frame, v = fvc.t3_orthogonal_representations(x)
>>> groups = sharing.validate_sharing((0, 0, 1), (6, 6, 4))
>>> lf = sharing.fv_tied_lift_factors(frame, 1e-3, sharing.fv_shared_frame_data(frame, groups))
>>> uframe = ufc.t3frame_to_ut3frame(frame, N=7, nD=5, nU=5, rL=3, rR=3)       # padding on every edge
>>> ulf = ufo.ufv_tied_lift_factors(uframe, 1e-3, sharing.ufv_shared_frame_data(uframe, groups))
>>> f, uf = lf.tied_filters[0], ulf.tied_filters[0]
>>> f.shape, uf.shape, bool(np.allclose(uf[:4], f)), uf[4:].tolist()
((4,), (5,), True, [0.0])
>>> uv = ufc.t3variations_to_ut3variations(v, N=7, nD=5, nU=5, rL=3, rR=3)
>>> theta_hat = utvo.utv_corewise_lift(uframe, uv, ulf)
>>> bool(np.array_equal(theta_hat[0][0], theta_hat[0][1]))                   # one factor direction per group
True
Parameters:
Return type:

LiftFactors