tv_corewise_lift_transpose#

t3toolbox.backend.tv_operations.tv_corewise_lift_transpose(frame, core_variations, lift_factors)#
def tv_corewise_lift_transpose(
        frame:              typ.Tuple[
            typ.Sequence[NDArray],              # down_tucker_cores. len=d, elm_shape=C+(nDi, Ni)
            typ.Sequence[NDArray],              # up_tt_cores.       len=d, elm_shape=C+(rLi, nUi, rR(i+1))
            typ.Sequence[NDArray],              # left_tt_cores.     len=d, elm_shape=C+(rLi, nDi, rL(i+1))
            typ.Sequence[NDArray],              # right_tt_cores.    len=d, elm_shape=C+(rRi, nDi, rR(i+1))
        ],
        core_variations:    typ.Tuple[
            typ.Sequence[NDArray],              # raw Tucker-core variations. len=d, elm_shape=K+C+(nDi, Ni)
            typ.Sequence[NDArray],              # raw TT-core variations.     len=d, elm_shape=K+C+(rLi, nDi, rL(i+1))
        ],
        lift_factors:       fv_operations.LiftFactors,  # the frame's, fv_operations.fv_lift_factors; stack C
) -> typ.Tuple[
    typ.Tuple[NDArray, ...],                    # UNGAUGED tucker_variations. len=d, elm_shape=K+C+(nUi, Ni)
    typ.Tuple[NDArray, ...],                    # UNGAUGED tt_variations.     len=d, elm_shape=K+C+(rLi, nDi, rR(i+1))
]:

The transpose of tv_corewise_lift(): raw core variations back to frame coordinates.

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

the exact adjoint of the lift in the coordinate (corewise) inner products, <L v, y>_raw == <v, L^T y>_frame per K + C element, for every damping – the same lift_factors serve both directions, which is what keeps L^T K L symmetric. The result is ungauged: compose with tv_orthogonal_gauge_projection() for gauged coordinates (the Riemannian Hessian applies the projection outside, Pi L^T K L Pi).

With tied lift factors (a shared point) each group’s raw Tucker variations are summed over the group’s copies (T^T) and mapped back by the tied solve’s adjoint, [V_i1; ...] = (M_g^{+eps})^T sum_i Bdot_i; the result is ungauged and untied – the shared Hessian’s Pi_sh ties it.

Batching as the lift: factors C, variations K + C. frame keeps the calling convention and is checked structurally (mode counts), not read.

Examples

The adjoint identity, at a damping where the lift is no longer an exact inverse:

>>> import numpy as np
>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.corewise as cw
>>> import t3toolbox.backend.fv_conversions as fvc
>>> import t3toolbox.backend.fv_operations as fvo
>>> import t3toolbox.backend.tv_operations as tvo
>>> 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)
>>> lf = fvo.fv_lift_factors(frame, 1e-2)
>>> v = fvo.fv_variations_randn(fvo.fv_variation_shapes(frame), ())
>>> y = (tuple(np.random.randn(*D.shape) for D in frame[0]),                 # raw, shaped like (D, L)
...      tuple(np.random.randn(*G.shape) for G in frame[2]))
>>> Lv, LTy = tvo.tv_corewise_lift(frame, v, lf), tvo.tv_corewise_lift_transpose(frame, y, lf)
>>> print(bool(np.isclose(cw.corewise_dot(Lv, y), cw.corewise_dot(v, LTy))))
True
Parameters:
  • frame (t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Sequence[NDArray], t3toolbox.backend.common.typ.Sequence[NDArray], t3toolbox.backend.common.typ.Sequence[NDArray], t3toolbox.backend.common.typ.Sequence[NDArray]])

  • core_variations (t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Sequence[NDArray], t3toolbox.backend.common.typ.Sequence[NDArray]])

  • lift_factors (LiftFactors)

Return type:

t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[NDArray, …], t3toolbox.backend.common.typ.Tuple[NDArray, …]]