tv_corewise_lift#
- t3toolbox.backend.tv_operations.tv_corewise_lift(frame, variations, lift_factors)#
def tv_corewise_lift( 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)) ], variations: typ.Tuple[ typ.Sequence[NDArray], # tucker_variations. len=d, elm_shape=K+C+(nUi, Ni) typ.Sequence[NDArray], # tt_variations. len=d, elm_shape=K+C+(rLi, nDi, rR(i+1)) ], lift_factors: fv_operations.LiftFactors, # the frame's, fv_operations.fv_lift_factors; stack C ) -> typ.Tuple[ typ.Tuple[NDArray, ...], # Bdot. len=d, elm_shape=K+C+(nDi, Ni) typ.Tuple[NDArray, ...], # Gdot. len=d, elm_shape=K+C+(rLi, nDi, rL(i+1)) ]:
Lift frame coordinates to raw core variations:
theta_hat, the lift ofv.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},with the frame’s damped pseudo-inverses
lift_factors(fv_lift_factors()). The output is a variation of the frame’s own raw corestheta = (D, L)(the base point in its left-canonical gauge): ateps = 0,tv_to_dense(t3_corewise_frame((D, L)), theta_hat) == tv_to_dense(frame, v)for any coordinates
v– gauged or not – on every numerically full-rank framet3_orthogonal_representationsbuilds, minimal or not (the pseudo-inverses are exact one-sided inverses there); at a rank-deficient point the clipped directions drop out,dPhi[theta_hat] = E(Q v)(seefv_lift_factors()). This is how a tangent direction reaches the core parametrizationPhi: the second derivative ofPhialongtheta_hatis what carries the curvature (Weingarten) term of the Riemannian Hessian (Absil, Mahony & Trumpf (2013), “An extrinsic look at the Riemannian Hessian”).theta = (D, L)is written by the frame’s stores it is built from (down, left); its corewise directiontheta_hat = (Bdot, Gdot)moves the point’s own raw cores, so it takesB.The last TT slot passes through undamped:
H_{d-1}multiplies no inverse. A dampingeps > 0bounds every other slot by1/(2 eps)near a rank drop; the identity then holds toO(eps^2 / sigma^2)on the well-conditioned directions. The transposetv_corewise_lift_transpose()uses the SAME factors, so the composition – the lift’s adjoint, thenK, then the lift – is symmetric for everyeps.Shared points. With tied lift factors (
fv_tied_lift_factors()) each nontrivial sharing group’s Tucker slots lift to ONE factor direction,Bdot_g = M_g^{+eps} [V_i1; ...]against the stackedM_g = [S_i1^T; ...], the same array at every group mode – the lift of the tied parametrizationPhi(T theta_sh),Tcopying the group factor; singleton modes and the TT slots lift as above.Batching: the factors carry the frame stack
C; the variations carryK + C– one lift per tangent at the common frame, the factors broadcast overK(grouped contractions,Cpinned by the factors).frameis not read by the arithmetic – the factors carry everything – but keeps the(frame, variations)calling convention, and the mode counts are checked against it (structural).Examples
A stack of three tangents at one frame, lifted exactly (
curvature_damping = 0):>>> 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 >>> 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), (3,)) # K = (3,), ungauged >>> theta_hat = tvo.tv_corewise_lift(frame, v, fvo.fv_lift_factors(frame, 0.0)) >>> print([b.shape for b in theta_hat[0]], [G.shape for G in theta_hat[1]]) [(3, 2, 5), (3, 3, 6), (3, 2, 7)] [(3, 1, 2, 2), (3, 2, 3, 2), (3, 2, 2, 1)] >>> corewise_frame = fvc.t3_corewise_frame((frame[0], frame[2])) # theta = (D, L) >>> print(np.allclose(tvo.tv_to_dense(corewise_frame, theta_hat), tvo.tv_to_dense(frame, v))) 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]])
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, …]]