utv_corewise_lift#

t3toolbox.backend.utv_operations.utv_corewise_lift(frame_data, variations_data, lift_factors)#
def utv_corewise_lift(
        frame_data,         # UT3Frame .data (an orthogonal frame), supercore stack = C
        variations_data,    # UT3Variations .data, supercore stack = K + C (masks over K + C)
        lift_factors,       # fv_operations.LiftFactors of the frame, ufv_operations.ufv_lift_factors; stack C
):  # -> plain-UT3 .data of the raw direction theta_hat = (Bdot, Gdot, shape, (down, left) masks over K + C)

The uniform twin of tv_corewise_lift(): frame coordinates -> raw core variations of the base point (D, L), theta_hat, the lift of v,

Bdot_i = (S_i^T)^{+eps} V_i, Gdot_i = H_i x_3 T_i^{+eps} (i <= d-2), Gdot_{d-1} = H_{d-1},

as two d-prefixed grouped contractions over the whole supercores (the last TT slot is the factors’ boundary pass-through slice, so it needs no special case). The variations are masked on entry with their own masks, and the output carries the frame’s (down, left) masks – the base point’s – broadcast over K, re-masked with them, so its padding is exactly zero. Per stack element, the real block is the ragged lift of the real blocks (to_uniform -> lift -> to_ragged == lift).

Shared points. With tied lift factors (ufv_tied_lift_factors()) each nontrivial sharing group’s Tucker slots lift to ONE factor direction, Bdot_g = M_g^{+eps} [V_i1; ...] against the companion’s stacked M_g (the ragged tied solve, on the masked supercore slices), written into every group mode’s slice – the same values at each, as the ragged lift’s one array per group – then re-masked with the rest.

Batching: factors C; variations and output K + C (the factors broadcast over K).

Examples

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.backend.fv_conversions as fvc
>>> import t3toolbox.backend.fv_operations as fvo
>>> import t3toolbox.backend.tv_operations as tvo
>>> import t3toolbox.backend.ufv_conversions as ufc
>>> import t3toolbox.backend.ufv_masking as ufm
>>> import t3toolbox.backend.ufv_operations as ufo
>>> import t3toolbox.backend.utv_operations as utvo
>>> np.random.seed(0)
>>> x = t3.TuckerTensorTrain.randn((5, 6, 7), (2, 3, 2), (1, 2, 2, 1))
>>> frame, _ = fvc.t3_orthogonal_representations(x.data)
>>> v = fvo.fv_variations_randn(fvo.fv_variation_shapes(frame), ())
>>> uframe = ufc.t3frame_to_ut3frame(frame, N=8, nD=4, nU=4, rL=3, rR=3)
>>> uv = ufc.t3variations_to_ut3variations(v, N=8, nD=4, nU=4, rL=3, rR=3)
>>> theta_hat = utvo.utv_corewise_lift(uframe, uv, ufo.ufv_lift_factors(uframe, 0.0))
>>> ragged = tvo.tv_corewise_lift(frame, v, fvo.fv_lift_factors(frame, 0.0))
>>> theta_hat[0].shape, theta_hat[1].shape                       # (d,)+(nD, N), (d,)+(rL, nD, rL)
((3, 4, 8), (3, 3, 4, 3))
>>> all(np.allclose(theta_hat[1][i][:G.shape[0], :G.shape[1], :G.shape[2]], G) for i, G in enumerate(ragged[1]))
True